Ask A Question

Notifications

You’re not receiving notifications from this thread.

What is the best way to have User in some group and select those groups on Event

Jaroslav Horák asked in Rails

Hi,
I have two models User and Event.
User should belong to one group and User could attend Event based on selected group.
Event could be open for one or many groups.

My first solution was to create a Group model with has_one User and has_and_belongs_to_many for Event.
But client would not change those groups.
So is there a better way to do it without extra model and DB?

I think about something with enums but don't know how to do it with multiple groups on Event.
Or maybe there is some other solution?
Any tips? =)

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 84,387+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.