rails/rails — pull request #6676 by aurelian (2012-06-08 10:53:27+00:00)
Title: Don't assign the attributes if the list is empty

This will skip assigning the attributes if an empty Hash was provided.

I've noticed this behavior kicking in when using something like collection#others.build (without any parameters):

```ruby
class Task < ActiveRecord::Base
belongs_to :account
end

class Account < ActiveRecord::Base
has_many :tasks
end

account = Account.first
account.tasks.build
```

This will assign_attributes on task twice:

* first with {} as a parameter when Task object is initialized
* second when the association is created with {:account_id => 666} as parameter (replace 666 with the actual account id).

Should also apply to 3.2 branch.