remiprev/her — pull request #179 by lleger (2013-10-07 22:40:09+00:00)
Title: Add `_ids` has_many association array

**What**
This commit adds a getter and setter to has many associations for an `_ids` array. It returns this array in `to_params` and removes the association parameter.

**Why**
If you have a user who has many posts and you send a `posts` parameter, AR will throw a `ActiveRecord::AssociationTypeMismatch` because it's expecting an association when you're sending a hash. You can either, instead, send along `post_attributes` (to create the object and relationship) or `post_ids` (to create the relationship if the object already exists). The former was already present in Her; this commit adds the latter. This commit also avoids the AR error.

**How**
A getter and setter is defined when attaching a has many association. The list of attributes when requesting `to_params` is filtered to remove the association array and add the `_ids` array.

This PR includes passing tests and has been integrated into a production app. This problem was discussed in #153 and credit to @calmyournerves for the code and tests to filter out the association array. This PR also includes commits from #178.

**Example**
```ruby
class Post
include Her::Model
belongs_to :user

attributes :title
end

class User
include Her::Model
has_many :posts

attributes :name
end

@user = User.find(1)
@user.post_ids # => [0, 1, 5]
@user.post_ids = [0, 1, 5, 14]
@user.to_params # => { name: "Tobias Funke", post_ids: [0, 1, 5, 14] }
```