I'm doing this in application controller:
before_filter :set_app_host
def set_app_host
Rails.application.routes.default_url_options[:host] = "some url"
end
This is to have a dynamic host name that can show up in link_to
helper method.
However this is not working, and the origina开发者_如何学JAVAl host name is showing instead. Any ideas?
In application_controller.rb
def default_url_options(options = nil)
{ :host => "example.com" }
end
From: http://edgeguides.rubyonrails.org/action_controller_overview.html#default_url_options
精彩评论