Please quote when replying.

bourne wrote in post #976269:
> Thanks Marnen for the pointer to the attributes method!
>
> For the archives:
> <% @comments.each do |comment| %>
>    <% comment.attributes.each_pair do |key, value| %>
>           <%= key %>: <%= value %><br />
>    <% end %>
> <% end %>

You're welcome!  That looks like it will do what you want (but if you're 
not using Rails 3, remember to put in appropriate HTML escaping). Other 
possibilities:
* Just use comment.attributes.inspect
* Instead of looping explicitly through comments, use render :partial, 
:collection

Also, if you do this a lot (i.e. more than once or twice), build a 
helper.

Oh, and consider using Haml instead of ERb...it's a lot nicer.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

-- 
Posted via http://www.ruby-forum.com/.

-- 
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