I have models:
has_many :projects, :through => :bookings
has_many :weeks, :through => :bookings
Now I want to get all coresponding entries from the bookings and weeks
table filtered by a query.
@bookings = Booking.find_all_by_project_id(params[:id])
=> [#<Booking id: 1, week_id: 47, project_id: 2, hour: 4>, #<Booking id:
week_id: 48, project_id: 2, hour: 7>]
I have tried soething like that:
Week.includes(:bookings).where(‘bookings.week_id = ?’, @bookings).all
How to get that working? Thanks for help.