Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Properly initialize variables inside the initialize method.

  • Loading branch information...
commit dd83140b24dcb8a27e226c9de286318a44d7fab1 1 parent 8adb240
José Valim josevalim authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 actionpack/lib/action_dispatch/routing/route_set.rb
11 actionpack/lib/action_dispatch/routing/route_set.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.