Skip to content

Instantly share code, notes, and snippets.

@jmaicher
Created February 11, 2011 10:15
Show Gist options
  • Save jmaicher/822166 to your computer and use it in GitHub Desktop.
Save jmaicher/822166 to your computer and use it in GitHub Desktop.
module UrlHelper
def generate_my_url(obj)
my_path({ :obj_id => obj.slug })
end
# [..]
end
class MyCell < Cell::Rails
helper UrlHelper
# [..]
end
# cell template
link_to "My Link", generate_my_url(obj) # -> Missing host to link to! Please provide :host parameter or set default_url_options[:host]
link_to "My Link", my_path({ :obj_id => obj.slug }) # -> works
class MyController < ApplicationController
include UrlHelper
def my_action
redirect_to generate_my_url(@obj) and return # -> works
redirect_to my_path({ :obj_id => @obj.slug }) and return # -> works
render :some_other_action
end
# [..]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment