ruby on rails - Searching over multiple ActiveRecord models -
I have difficulty creating a suitable ActiveRecord query to search for the kitchen, which is a city area and food , Which has a date field.
square kitchens & lt; ActiveRecord :: Base is_to: User has_many: By Food: User & Class User & lt; ActiveRecord :: Base is_On: Kitchen has has_many: Food End Class Meal & lt; ActiveRecord :: Base is_to: User Rep: For Kitchen: User End
I want to do something on the lines of this:
date = date. New [params [: date] [: year] .to_i, params [: date] [: month] .to_i, consultation [[date] [: day] .to_i) @ mi = food. Where (food_date: date) @ meals.reject {| Food | Meal.kitchen.city.downcase! = Params [: City] .downcase}
@ Anthony has told you to eat food and If there is a need to add a collaboration between the kitchen, then you should be able to do questions against food
based on the city of kitchen
.
square kitchens & lt; ActiveRecord :: Base is_to: User has_many: Food and Class users & lt; ActiveRecord :: Base is_On: Kitchen has has_many: Food End Class Meal & lt; For example, something like: food. (Food: kitchen). Where (food_data: date, kitchen: {city! = Param [: city]}) See
for more information.
Comments
Post a Comment