Module: Proxy::ActionController::NamedRouteCollection
- Defined in:
- lib/proxy/action_controller/named_route_collection.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#define_url_helper_with_proxy(route, name, kind, options) ⇒ Object
Named route url helpers (not path helpers) don’t seem to work correctly with forwarded hosts unless we explicitly set the option:.
Class Method Details
.included(base) ⇒ Object
4 5 6 |
# File 'lib/proxy/action_controller/named_route_collection.rb', line 4 def self.included(base) base.class_eval { alias_method_chain :define_url_helper, :proxy } end |
Instance Method Details
#define_url_helper_with_proxy(route, name, kind, options) ⇒ Object
Named route url helpers (not path helpers) don’t seem to work correctly with forwarded hosts unless we explicitly set the option:
:only_path => false
This method only sets that option if it isn’t set already
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/proxy/action_controller/named_route_collection.rb', line 14 def define_url_helper_with_proxy(route, name, kind, ) define_url_helper_without_proxy(route, name, kind, ) if kind == :url selector = url_helper_name(name, kind) @module.module_eval do define_method "#{selector}_with_proxy" do |*args| args << {} unless args.last.is_a? Hash args.last[:only_path] ||= false send "#{selector}_without_proxy", *args end alias_method_chain selector, :proxy end end end |