私は次のような属性をループしようとします:
<% student.account.attributes.each do |value| %>
<td><%= value %></td>
<% end %>
大丈夫です。しかし、ループから特定の属性を除外するにはどうすればよいですか?['one'、'two'、'three']のような配列を使用しました。ここで、'one'、'two'、および'three'は除外する値です(または、これが簡単な場合は、includeします)。
編集:
@Vysakh Sreenivasanによって提案されたように、私はついにこれを使用しました:
<% exclude_keys = ['one', 'two', 'three'] %>
<% student.account.attributes.each do |key, value| %>
<td><%= value unless exclude_keys.include? key %></td>
<% end %>