Hi, so I am trying to display the author’s name of comments. I am
able to display the comments by iterating through the hash
@comments = PhotoComment.find(:all, :conditions => { :photo_id =>
params[:photo_id] }),
but I want to be able to display the name associated with the author
of each comment. The iteration in my view looks like this:
<% for comment in @comments -%>
on <%= comment.created_at.strftime(’%m-%d-%Y’) %> @
<%= comment.created_at.strftime(’%I:%M’) %> BLANK said:
<%= white_list comment.comment %>
<% end -%>
I would like to interchange the BLANK with the commentors name. Each
PhotoComment object has a user_id field which stores the user id for
the author of the comment. This name is stored in another table
called users. How do I append this name into the @comments hash? Is
this how you do it? or do you create another variable for the author
names? Thanks.