rails/rails — pull request #4331 by baroquebobcat (2012-01-05 20:01:50+00:00)
Title: 2.3 association collection's find_or_create_by doesn't accept hashes.

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:

```ruby
joe = Person.friends.find_or_create_by_name :name => 'joe'
joe.name
#=> {: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'