Forum: Ruby on Rails Help iterating over attributes of an AR object

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
B965bae86df56534d608c5938266522c?d=identicon&s=25 Guðni Hilmarsson (Guest)
on 2007-04-17 10:39
(Received via mailing list)
Hi all...

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

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

this code obviously doesn't work...any help would be much appreciated.
This topic is locked and can not be replied to.