Displaying 2 results from an estimated 2 matches for "note_date".
Did you mean:
node_data
2006 Sep 28
5
Eager loading using find_by_sql
...roblem I have the following models
User - is a person
Team - is a team
Wherenote - snipet of info about a user''s whereabouts on a certain day
Team has_and_belongs_to_many :users
User has_and_belongs_to_many :teams
has_many :wherenotes
Wherenote belongs_to :user
each Wherenote has a note_date
On one page I want to pull back all the Users from a particular Team and
then display all their Wherenotes for a given day.
Currently this is done by getting team.users and then doing a separate
find for
each of the users looking for Wherenotes with a particular note date.
The dreaded n+1 prob...
2006 Feb 08
0
foreign table references...a new twist
...ment_id'' (there''s only 1).
If I have a looped structure, I can make this work but it repeats the
placement record 1 time for each referral_note...
<% for referral_note in @referral_notes %>
<%=h (referral_note.placement.client.wholename) %>
<%=h (referral_note.note_date) %>
<% end %>
but if I take the first line out of the loop...
<%=h (referral_note.placement.client.wholename) %>
<% for referral_note in @referral_notes %>
<%=h (referral_note.note_date) %>
<% end %>
it errors - not having a definition for ''referral_no...