2.3 association collection's find_or_create_by doesn't accept hashes. #4331

wants to merge 1 commit into


None yet
1 participant

baroquebobcat commented Jan 5, 2012

I was updating a 2.3.8 app to 2.3.14 and ran into an issue where association's find_or_create_by* methods no longer accepted hashes. When passing a hash to a dynamic finder, this would happen:

joe = Person.friends.find_or_create_by_name :name => 'joe'
#=> {:name => 'joe'}

This patch changes a test to check that a find_or_create_by created object has the expected attribute value & changes AssociationCollection#method_missing so that find_or_create_by* will accept either a single hash as an argument, or a list of arguments corresponding to the find_or_create_by* attributes followed by a hash.

  • find_or_create_by_foo :foo => 'bar', :baz => 'qux'
  • find_or_create_by_foo 'foo', :baz => 'qux'

This comment has been minimized.

Show comment
Hide comment

baroquebobcat Jan 9, 2012


Closing. 2.3 isn't accepting patches other than security ones.


baroquebobcat commented Jan 9, 2012

Closing. 2.3 isn't accepting patches other than security ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment