Ruby on Rails
Tuesday, August 6, 2019
I think I got it... I knew it had to be simple in Rails to do that...
-- Just had to add
belongs_to :motd, class_name: 'Meal', foreign_key: :motd_id
has_and_belongs_to_many :meals
has_and_belongs_to_many :mdrinks
Now I have a Meal of the Day as well as Daily Meals
John
On Sunday, August 4, 2019 at 9:29:08 AM UTC-4, John Sanderbeck wrote:
On Sunday, August 4, 2019 at 9:29:08 AM UTC-4, John Sanderbeck wrote:
I am building a Lunch Ordering Module for my app and I have these models currentlyMenu:menu_date:menu_typeMeal:name:mentree_id:available_dailyMentree:nameMsides:nameMdrink:nameRight now I am using a has_and_belongs_to_many onmeals_menusmdrinks_menusmeals_msidesWhat I need to have is a Meal of the Day as part of the Menu and I am thinking I should use a has_many through:But I can't think how to structure this correctlyMy goal is to have the cafeteria be able to turn on and off meals and drinks on the menu based on availability, so when the class orders lunch they can only choose the available meals.However I have a Lunch Calendar that I want to show the meal of the day.Suggestions on the proper Rails structure?John
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ff41eba9-5ad5-41c9-b82f-d6f219f27acf%40googlegroups.com.
Subscribe to:
Post Comments (Atom)


No comments:
Post a Comment