Sorry for the delay in getting back on this but I’ve just got back from
Okay, so Max, you and I agree on the modelling for this concept so that
starts to narrow down where my problem is.
To begin with, I thought my problem was because I had a join model
the parent to another join model and maybe the primary key of Authorings
wasn’t being created before the join to AuthoringRole was being made.
Where we disagree is in the relationships and so this is obviously where
I agree with all your relationships but I’ve added a bit extra … In
book.rb, I have included accepts_nested_attributes_for :authors,
and also have a has_many :authoring_roles, :through => :authorings
I’ve done this because I want to accept all that information when
book. when I say @book.save, I want it to include the roles as well as
So how should I set that up? In my real world example Book == Account,
Author == Member and Role is one or many of Account Contact/Swimmer/etc.
When creating a new Book (Account), I am creating a new Author (Member)
so the form accepts_nested_attributes_for :authors, :authoring_roles (in
obviously mixed up logic)
If I have a form where I accept Book, Author and Role information and
want to create/update the Book, Author, Authorings and AuthoringRoles
through @book,save, how to go about it?
I’ll have a play with this now and if I can break myself out of my cycle
crack it, I’ll get in touch. If you/someone provides me the solution
that, I’d be grateful as this has been sending me mad.
On 5 March 2010 14:10, Max W. [email protected] wrote:
has_many :roles, :through => :authoring_roles
100% naturally selected. 0% designed.