Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

always pass options to the _url method

  • Loading branch information...
commit b44bfa4c244e25642bd838972ee41669d2b37222 1 parent 7f97eac
@tenderlove tenderlove authored
View
4 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
@@ -135,9 +135,7 @@ def polymorphic_url(record_or_hash_or_array, options = {})
named_route = build_named_route_call(record_or_hash_or_array, record, inflection, options)
url_options = options.except(:action, :routing_type)
- unless url_options.empty?
- args << url_options
- end
+ args << url_options
args.collect! { |a| convert_to_model(a) }
View
16 actionview/test/template/test_test.rb
@@ -37,10 +37,20 @@ def test_homepage_url
def test_link_to_person
with_test_route_set do
- person = mock(:name => "David")
- person.class.extend ActiveModel::Naming
- expects(:mocha_mock_path).with(person).returns("/people/1")
+ person = Struct.new(:name) {
+ extend ActiveModel::Naming
+ def self.name; 'Mocha::Mock'; end
+ }.new "David"
+
+ the_model = nil
+ extend Module.new {
+ define_method(:mocha_mock_path) { |model, *args|
+ the_model = model
+ "/people/1"
+ }
+ }
assert_equal '<a href="/people/1">David</a>', link_to_person(person)
+ assert_equal person, the_model
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.