diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-09-11 17:14:29 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-09-12 16:50:48 -0700 |
commit | a08bee784125d569f63ddd9fa875ae9c5d18b342 (patch) | |
tree | 94ae684605a4d711d167c88edd5d6a2f2859f8b2 /actionpack | |
parent | b7ccfa96d2f5b95ec4544716571c1e90f0b89464 (diff) | |
download | rails-a08bee784125d569f63ddd9fa875ae9c5d18b342.tar.gz rails-a08bee784125d569f63ddd9fa875ae9c5d18b342.tar.bz2 rails-a08bee784125d569f63ddd9fa875ae9c5d18b342.zip |
all routes can be stored in the Journey Routes object
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/route_set.rb | 9 | ||||
-rw-r--r-- | actionpack/test/controller/resources_test.rb | 2 | ||||
-rw-r--r-- | actionpack/test/dispatch/mapper_test.rb | 1 |
3 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 000b2a252f..2947eb3f09 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -206,16 +206,17 @@ module ActionDispatch end end - attr_accessor :formatter, :set, :routes, :named_routes, :default_scope, :router + attr_accessor :formatter, :set, :named_routes, :default_scope, :router attr_accessor :disable_clear_and_finalize, :resources_path_names attr_accessor :default_url_options, :request_class, :valid_conditions + alias :routes :set + def self.default_resources_path_names { :new => 'new', :edit => 'edit' } end def initialize(request_class = ActionDispatch::Request) - self.routes = [] self.named_routes = NamedRouteCollection.new self.resources_path_names = self.class.default_resources_path_names.dup self.default_url_options = {} @@ -274,7 +275,6 @@ module ActionDispatch def clear! @finalized = false - routes.clear named_routes.clear set.clear formatter.clear @@ -346,9 +346,8 @@ module ActionDispatch def add_route(app, conditions = {}, requirements = {}, defaults = {}, name = nil, anchor = true) raise ArgumentError, "Invalid route name: '#{name}'" unless name.blank? || name.to_s.match(/^[_a-z]\w*$/i) route = Route.new(self, app, conditions, requirements, defaults, name, anchor) - @set.add_route(app, route.conditions, defaults, name) + route = @set.add_route(app, route.conditions, defaults, name) named_routes[name] = route if name - routes << route route end diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index b9cd15708b..6b8a8f6161 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -532,7 +532,7 @@ class ResourcesTest < ActionController::TestCase routes.each do |route| routes.each do |r| next if route === r # skip the comparison instance - assert_not_equal route.conditions, r.conditions + assert_not_equal [route.conditions, route.path.spec.to_s], [r.conditions, r.path.spec.to_s] end end end diff --git a/actionpack/test/dispatch/mapper_test.rb b/actionpack/test/dispatch/mapper_test.rb index 3316dd03aa..d3465589c1 100644 --- a/actionpack/test/dispatch/mapper_test.rb +++ b/actionpack/test/dispatch/mapper_test.rb @@ -5,6 +5,7 @@ module ActionDispatch class MapperTest < ActiveSupport::TestCase class FakeSet attr_reader :routes + alias :set :routes def initialize @routes = [] |