diff options
author | José Valim <jose.valim@gmail.com> | 2010-09-27 22:58:31 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-27 22:58:31 +0200 |
commit | dd83140b24dcb8a27e226c9de286318a44d7fab1 (patch) | |
tree | 50167e1c8b20737daba61cb1c85b8cb4b7ddc2ee | |
parent | 8adb24016d76a2257b79f4566de66e1b88e56c71 (diff) | |
download | rails-dd83140b24dcb8a27e226c9de286318a44d7fab1.tar.gz rails-dd83140b24dcb8a27e226c9de286318a44d7fab1.tar.bz2 rails-dd83140b24dcb8a27e226c9de286318a44d7fab1.zip |
Properly initialize variables inside the initialize method.
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 66b487ba6d..e25b30ffa6 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -304,9 +304,9 @@ module ActionDispatch extend ActiveSupport::Concern include UrlFor - @routes = routes + @_routes = routes class << self - delegate :url_for, :to => '@routes' + delegate :url_for, :to => '@_routes' end extend routes.named_routes.module @@ -318,7 +318,12 @@ module ActionDispatch singleton_class.send(:define_method, :_routes) { routes } end - define_method(:_routes) { @_routes ||= nil; @_routes || routes } + def initialize(*) + @_routes = nil + super + end + + define_method(:_routes) { @_routes || routes } end helpers |