I am looking for some advice in putting together the proper models and
relationships in my application. My concern revolves around the
requirement to have default prices, but allow them to be optionally
overridable.
The application involves clients choosing from menus of various
dishes. Several menus are predefined and the client chooses the one
they want to use.
The models I’ve identified are Dish, Menu & Client. Menu has_many
dishes and Client has_one menu. Dishes have a name and a default
price. So far so good.
Now the puzzle: What’s the best way to model the overriding of a
dish’s price on a client by client basis? Clients are related to
dishes through menus, but menus are shared across clients.
I think I need another join table which stores dish_id, client_id and
price. But then how to describe the relationship to rails?
Thanks for any advice on this.