Reputation:
My app has a User model, and a Game model. I want each user to be able to add their own personal set of Game attributes (that are only available/visible to them) aside from the ones I already have predefined.
What's the most 'Rails' way of going about this?
Upvotes: 1
Views: 110
Reputation: 27961
You'll store per-user settings in the join table between User
and Game
and then your association between those two models will be a has_many :through
- meaning that you'll have a join model giving you access to the attributes.
Upvotes: 1
Reputation: 115531
I'd advise you to use serialization:
Advantages:
it's much flexible and built in
you can store data the way you want (even your custom class)
Drawback:
Upvotes: 1