From 5835447b6fbc956f22011fc33bcc882db144c7c1 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 7 Dec 2009 19:31:29 -0600 Subject: named_prefix doesn't join with "_" --- actionpack/lib/action_dispatch/routing/mapper.rb | 8 ++++---- actionpack/test/dispatch/routing_test.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index abcaa529ae..7eb648cedf 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -63,7 +63,7 @@ module ActionDispatch controller(resource.controller) do namespace(resource.name) do - with_scope_level(:resource, :name => resource.singular, :name_prefix => resource.member_name) do + with_scope_level(:resource, :name => resource.singular, :name_prefix => "#{resource.member_name}_") do yield if block_given? get "", :to => :show, :as => resource.member_name @@ -103,7 +103,7 @@ module ActionDispatch controller(resource.controller) do namespace(resource.name) do - with_scope_level(:resources, :name => resource.singular, :name_prefix => resource.member_name) do + with_scope_level(:resources, :name => resource.singular, :name_prefix => "#{resource.member_name}_") do yield if block_given? collection do @@ -202,7 +202,7 @@ module ActionDispatch if name_prefix = options.delete(:name_prefix) name_prefix_set = true - name_prefix, @scope[:name_prefix] = @scope[:name_prefix], (@scope[:name_prefix] ? "#{@scope[:name_prefix]}_#{name_prefix}" : name_prefix) + name_prefix, @scope[:name_prefix] = @scope[:name_prefix], (@scope[:name_prefix] ? "#{@scope[:name_prefix]}#{name_prefix}" : name_prefix) else name_prefix_set = false end @@ -382,7 +382,7 @@ module ActionDispatch validate_defaults!(app, defaults, segment_keys) app = Constraints.new(app, blocks) - name = @scope[:name_prefix] ? "#{@scope[:name_prefix]}_#{options[:as]}" : options[:as] + name = @scope[:name_prefix] ? "#{@scope[:name_prefix]}#{options[:as]}" : options[:as] @set.add_route(app, conditions, requirements, defaults, name) diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 86cf2ce335..0a35868d7c 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -93,7 +93,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end controller :articles do - scope 'articles', :name_prefix => 'article' do + scope 'articles', :name_prefix => 'article_' do scope :path => ':title', :title => /[a-z]+/, :as => :with_title do match ':id', :to => :with_id end -- cgit v1.2.3