The following code works, but can you tell me if this is the right way to do it?
I have an array of Position objects and I want to check if it contains an object which attribute 'hidden' has "false' value:
<% if positions.collect{|position| position.hidden}.include?(false) %>
...
<% end %>
if positions.map(&:hidden).include?(false)
. (Warning: this and the original approach will behave differently from the answers given below if the 'hidden' attribute ever returns nil.)