On Mar 11, 4:22 pm, cdubd <[email protected]> wrote:
> > > <%div_for(comment) do %>
> > >         <div id="comment_user"><%= user_for(comment.user_id)%><div
>
> > I don't know that user_for does, but that obviously won't use the
> > comment.user object that has already been loaded.
>
> well, the User object has many comments, the comments belong to user.
> As far as I can tell, calling comment.user will return nothing because
> there is only a user_id field.
> perhaps I could set up a Comment has_one :user relationship?

I'm not sure I follow. if comment belongs_to user, then comment.user
will return the user with id comment.user_id.

Fred
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to