Permalink
Browse files

Properly initialize variables inside the initialize method.

  • Loading branch information...
1 parent 8adb240 commit dd83140b24dcb8a27e226c9de286318a44d7fab1 @josevalim josevalim committed Sep 27, 2010
Showing with 8 additions and 3 deletions.
  1. +8 −3 actionpack/lib/action_dispatch/routing/route_set.rb
View
11 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -304,9 +304,9 @@ def url_helpers
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 @@ class << self
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

0 comments on commit dd83140

Please sign in to comment.