Ticket #8720: polymorphic_path_accepts_options_hash.diff
| File polymorphic_path_accepts_options_hash.diff, 1.4 kB (added by gbuesing, 2 years ago) |
|---|
-
test/controller/polymorphic_routes_test.rb
old new 28 28 end 29 29 alias_method :new_article_url, :articles_url 30 30 31 def articles_path 32 '/articles' 33 end 34 alias_method :new_article_path, :articles_path 35 31 36 def article_url(article) 32 37 "http://www.example.com/articles/#{article.id}" 33 38 end … … 67 72 @comment.save 68 73 assert_equal(article_comment_url(@article, @comment), polymorphic_url([@article, @comment])) 69 74 end 75 76 def test_polymorphic_path 77 assert_equal(articles_path, polymorphic_path(@article)) 78 assert_equal(new_article_path, polymorphic_path(@article, :action => 'new')) 79 end 70 80 end -
lib/action_controller/polymorphic_routes.rb
old new 26 26 send(named_route, *args) 27 27 end 28 28 29 def polymorphic_path(record_or_hash_or_array )30 polymorphic_url(record_or_hash_or_array, :routing_type => :path)29 def polymorphic_path(record_or_hash_or_array, options = {}) 30 polymorphic_url(record_or_hash_or_array, options.merge(:routing_type => :path)) 31 31 end 32 32 33 33 %w(edit new formatted).each do |action|