提交 fd567785 编写于 作者: J Jeremy Kemper

Make UrlWriter includable in a Module

上级 63bb955a
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册