On 3 March 2012 20:22, Kevin Pruett <[email protected]> wrote: > I'm writing my first Rails app and I'm stuck at the database level. I have 2 > models: User and Mission. They are connected very unremarkably like so: > > User has_many :missions, dependent: :destroy > Mission belongs_to :user > > I would like other users to be able to interact with missions by > either: liking them and/or marking them as completed > > This is all very vanilla stuff here, but I'm struggling with adding this > additional layer of interaction into the models. > > I started by creating a table Connection with > attributes user_id mission_id liked:booleancompleted:boolean
Since each mission belongs to just one user you can achieve what you want just by adding the liked and completed booleans to the missions table. You do not need another table. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

