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:
parent
8adb24016d
commit
dd83140b24
1 changed files with 8 additions and 3 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue