Roman Kiselenko
Roman Kiselenko

Reputation: 44370

Invitations between the two models Rails

I have two models. Weddings and guests.

class Wedding
  has_many guests
end

class Guest
  has_many weddings
end

How do I make what guests can accept or decline the invitation?

Upvotes: 0

Views: 109

Answers (1)

Leantraxxx
Leantraxxx

Reputation: 4596

You need to do a many to many relation with an intermediate model. See guides. See 2.4 The has_many :through Association topic here.

On that new model/table you can add an attribute (a boolean "decline" attribute maybe) to control guests assistance...

Upvotes: 1

Related Questions