From dd83140b24dcb8a27e226c9de286318a44d7fab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 27 Sep 2010 22:58:31 +0200 Subject: Properly initialize variables inside the initialize method. --- actionpack/lib/action_dispatch/routing/route_set.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') 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 -- cgit v1.2.3