Module: SecureRoutes::RouteSet
- Defined in:
- lib/secure_routes/route_set.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 |
# File 'lib/secure_routes/route_set.rb', line 4 def self.included base base.class_eval do alias_method_chain :url_for, :secure end end |
Instance Method Details
#url_for_with_secure(options) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/secure_routes/route_set.rb', line 10 def url_for_with_secure if Rails.application.config.action_dispatch.secure_routes [:only_path] = false if ([:secure] === true && [:protocol] == 'http://') || ([:secure] === false && [:protocol] == 'https://') [:protocol] = 'http://' if [:secure] === false [:protocol] = 'https://' if [:secure] === true end url_for_without_secure end |