thoughtbot/factory_girl — Issue #283: has_many through with added columns in join table
Author: JeanMertz
Created: 2012-01-26 18:48:57+00:00
State: open

Right now I use this Factory:

```
factory :team_member, class: 'Membership' do
account
user
role 'TeamMember'
end
```

I use this to directly create a has_many through relationship. The problem with this is that the Factory actually returns the relationship, there I ideally want it to return the team_member (User).

I tried the following:

```
factory :user do
...

accounts {|account| [account.association(:account)]}

factory :team_member do
end
end
```

which also works, and returns the actual user object, instead of the membership object, except that I don't know how to add the `role` value of `TeamMember` into the `Membership` join table.