How to remove record from join table

I’m able to add a record to a join table like this:

e = Event.find(m)
g = Group.find(n)
e.groups << g

But how can I remove the record? I imagine something like

e = Event.find(m)
g = Group.find(n)

But I haven’t found the right syntax yet. Anyone familiar with this?

I believe if you have both Event and Group as has_and_belongs_to_many
to each other, doing either e.destroy or g.destroy will automatically
remove the entry in the join table.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs