Skip to content

Commit

Permalink
Heckling ActionController::Resources::Resource revealed that set_pref…
Browse files Browse the repository at this point in the history
…ixes didn't break when :name_prefix was munged. rails#7081 [Kevin Clark]

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-pre-release@5975 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
technoweenie committed Jan 17, 2007
1 parent 81b94c2 commit e9e86fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*1.13.0* (January 16th, 2007)

* Heckling ActionController::Resources::Resource revealed that set_prefixes didn't break when :name_prefix was munged. #7081 [Kevin Clark]

* Update to Prototype 1.5.0. [Sam Stephenson]

* Allow exempt_from_layout :rhtml. #6742, #7026 [dcmanges, Squeegy]
Expand Down
21 changes: 14 additions & 7 deletions actionpack/test/controller/resources_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ def test_multile_with_path_prefix
assert_simply_restful_for :comments, :path_prefix => 'thread/5/', :options => { :thread_id => '5' }
end
end

def test_with_name_prefix
with_restful_routing :messages, :name_prefix => 'post_' do
assert_simply_restful_for :messages, :name_prefix => 'post_'
end
end

def test_with_collection_action
rss_options = {:action => 'rss'}
Expand Down Expand Up @@ -232,13 +238,14 @@ def assert_restful_named_routes_for(controller_name, singular_name = nil, option
options[:options].delete :action

full_prefix = "/#{options[:path_prefix]}#{controller_name}"

assert_named_route "#{full_prefix}", "#{controller_name}_path", options[:options]
assert_named_route "#{full_prefix}.xml", "formatted_#{controller_name}_path", options[:options].merge(:format => 'xml')
assert_named_route "#{full_prefix}/new", "new_#{singular_name}_path", options[:options]
assert_named_route "#{full_prefix}/1", "#{singular_name}_path", options[:options].merge(:id => '1')
assert_named_route "#{full_prefix}/1;edit", "edit_#{singular_name}_path", options[:options].merge(:id => '1')
assert_named_route "#{full_prefix}/1.xml", "formatted_#{singular_name}_path", options[:options].merge(:format => 'xml', :id => '1')
name_prefix = options[:name_prefix]

assert_named_route "#{full_prefix}", "#{name_prefix}#{controller_name}_path", options[:options]
assert_named_route "#{full_prefix}.xml", "formatted_#{name_prefix}#{controller_name}_path", options[:options].merge(:format => 'xml')
assert_named_route "#{full_prefix}/new", "#{name_prefix}new_#{singular_name}_path", options[:options]
assert_named_route "#{full_prefix}/1", "#{name_prefix}#{singular_name}_path", options[:options].merge(:id => '1')
assert_named_route "#{full_prefix}/1;edit", "#{name_prefix}edit_#{singular_name}_path", options[:options].merge(:id => '1')
assert_named_route "#{full_prefix}/1.xml", "formatted_#{name_prefix}#{singular_name}_path", options[:options].merge(:format => 'xml', :id => '1')
yield options[:options] if block_given?
end

Expand Down

0 comments on commit e9e86fd

Please sign in to comment.