Need help iterating over attributes of a Active record objec

Hi all…

I need help with a little ruby code. I am trying to output every
attribute of an actice record object something like:

<% for product in @products %>
<% for each product.attribute |attribute| %>

<% end %> <% end %>

product.attributes return a Hash object, so you want:

    <% product.attributes.each_pair do |k,v| %>
  • <%= k %> => <%= v %>
  • <% end %>

Thanks alot mate…