Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make UrlWriter includable in a Module

  • Loading branch information...
commit fd567785f4670b31db300324642cf2464025313e 1 parent 63bb955
Jeremy Kemper jeremy authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 actionpack/lib/action_controller/metal/url_for.rb
10 actionpack/lib/action_controller/metal/url_for.rb
View
@@ -1,4 +1,5 @@
require 'active_support/core_ext/class/attribute'
+require 'active_support/core_ext/module/attribute_accessors'
module ActionController
# In <b>routes.rb</b> one defines URL-to-controller mappings, but the reverse
@@ -87,7 +88,14 @@ module UrlFor
included do
ActionController::Routing::Routes.install_helpers(self)
- class_attribute :default_url_options
+
+ # Including in a class uses an inheritable hash. Modules get a plain hash.
+ if respond_to?(:class_attribute)
+ class_attribute :default_url_options
+ else
+ mattr_accessor :default_url_options
+ end
+
self.default_url_options = {}
end
Please sign in to comment.
Something went wrong with that request. Please try again.