Created
February 11, 2011 10:15
-
-
Save jmaicher/822166 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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