aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2010-02-05 12:23:22 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2010-02-05 12:23:22 -0800
commitfd567785f4670b31db300324642cf2464025313e (patch)
tree18bc6716fbb8fbbbfe381590f5aef915520ad23f
parent63bb955a99eb46e257655c93dd64e86ebbf05651 (diff)
downloadrails-fd567785f4670b31db300324642cf2464025313e.tar.gz
rails-fd567785f4670b31db300324642cf2464025313e.tar.bz2
rails-fd567785f4670b31db300324642cf2464025313e.zip
Make UrlWriter includable in a Module
-rw-r--r--actionpack/lib/action_controller/metal/url_for.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/url_for.rb b/actionpack/lib/action_controller/metal/url_for.rb
index 51702368c1..4f3ad07be5 100644
--- a/actionpack/lib/action_controller/metal/url_for.rb
+++ b/actionpack/lib/action_controller/metal/url_for.rb
@@ -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 ActionController
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