diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-09-27 16:17:32 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-09-27 16:43:33 -0300 |
commit | 8adb24016d76a2257b79f4566de66e1b88e56c71 (patch) | |
tree | dc299f0a34fff31ffbc5f22558cfcc3b26408476 | |
parent | 1ab2ab07b5e7c4031c014175887e9f20b8f60a4c (diff) | |
download | rails-8adb24016d76a2257b79f4566de66e1b88e56c71.tar.gz rails-8adb24016d76a2257b79f4566de66e1b88e56c71.tar.bz2 rails-8adb24016d76a2257b79f4566de66e1b88e56c71.zip |
Define @_routes inside method, makes more sense and will be initialized when called anywhere.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/routing/url_for.rb | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 4289e78641..66b487ba6d 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -318,7 +318,7 @@ module ActionDispatch singleton_class.send(:define_method, :_routes) { routes } end - define_method(:_routes) { @_routes || routes } + define_method(:_routes) { @_routes ||= nil; @_routes || routes } end helpers diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb index 045c9ec77d..e836cf7c8e 100644 --- a/actionpack/lib/action_dispatch/routing/url_for.rb +++ b/actionpack/lib/action_dispatch/routing/url_for.rb @@ -128,7 +128,6 @@ module ActionDispatch when String options when nil, Hash - @_routes ||= nil _routes.url_for((options || {}).reverse_merge!(url_options).symbolize_keys) else polymorphic_url(options) |