1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Properly initialize variables inside the initialize method.

This commit is contained in:
José Valim 2010-09-27 22:58:31 +02:00
parent 8adb24016d
commit dd83140b24

View file

@ -304,9 +304,9 @@ module ActionDispatch
extend ActiveSupport::Concern extend ActiveSupport::Concern
include UrlFor include UrlFor
@routes = routes @_routes = routes
class << self class << self
delegate :url_for, :to => '@routes' delegate :url_for, :to => '@_routes'
end end
extend routes.named_routes.module extend routes.named_routes.module
@ -318,7 +318,12 @@ module ActionDispatch
singleton_class.send(:define_method, :_routes) { routes } singleton_class.send(:define_method, :_routes) { routes }
end end
define_method(:_routes) { @_routes ||= nil; @_routes || routes } def initialize(*)
@_routes = nil
super
end
define_method(:_routes) { @_routes || routes }
end end
helpers helpers