Please remember to reply to the list and please don't top post, it
makes it difficult to follow the thread. Insert your reply inline at
appropriate points in the previous message. Thanks.
1. I ask for entries in booking with a certain project_id
@bookings = Booking.find_all_by_project_id(params[:id])
=> [#<Booking id: 1, week_id: 47, project_id: 2, hour: 4>, #<Booking id: 2,
week_id: 48, project_id: 2, hour: 7>]
So you know how to do that ok?
2. Get the values from the table week which have the week_id from the 1 (47,
48)
Sorry, still don't understand what that is supposed to mean. I
presume that you mean records rather than values and the table weeks
rather than weeks. So you want to get the records from the table
weeks. But that table does not have a column week_id, just id and no
idea what you mean by "from the 1(47,48)"
Please remember to reply to the list and please don't top post, it
makes it difficult to follow the thread. Insert your reply inline at
appropriate points in the previous message. Thanks.
1. I ask for entries in booking with a certain project_id
@bookings = Booking.find_all_by_project_id(params[:id])
=> [#<Booking id: 1, week_id: 47, project_id: 2, hour: 4>, #<Booking id: 2,
week_id: 48, project_id: 2, hour: 7>]
So you know how to do that ok?
2. Get the values from the table week which have the week_id from the 1 (47,
48)
Sorry, still don't understand what that is supposed to mean. I
presume that you mean records rather than values and the table weeks
rather than weeks. So you want to get the records from the table
weeks. But that table does not have a column week_id, just id and no
idea what you mean by "from the 1(47,48)"
Ah, I think I understand. You have a project_id in params[:id] and
you want to find the bookings and hence the weeks for that project id?
Why don't you just get the project for the id
@project = Project.find params[:id]
then the bookings, if you actually need the bookings
@bookings = @project.bookings
and/or the weeks by
@weeks = @project.weeks