I try to loop through attributes like this:
<% student.account.attributes.each do |value| %>
<td><%= value %></td>
<% end %>
which is ok. But, how can I exclude certain attributes, from being looped? I used an array like [‘one’, ‘two’, ‘three’] where ‘one’, ‘two’, and ‘three’ are the values to exclude (or, if this is easier – include).
Edit:
As suggested by @Vysakh Sreenivasan I finally used this:
<% exclude_keys = ['one', 'two', 'three'] %>
<% student.account.attributes.each do |key, value| %>
<td><%= value unless exclude_keys.include? key %></td>
<% end %>
if student.account.attributes is an array
One way
Another way