Reputation: 7619
Any code for checking a table-column's value? Lets say we have a table submittedpictures
and it contains a column called isFinalPicture
. There are 5 records, but only one of them has isFinalPicture == true
. The others are all false.
How can I check this?
I already tried something like
<% if @user.games.rounds.submitted_pictures.isFinalPicture.include?(true) %>
But it didnt really work, and I'm out of ideas
Upvotes: 1
Views: 984
Reputation: 54882
Maybe something like this:
<% if @user.games.rounds.submitted_pictures.where(:isFinalPicture => true).any? %>
Upvotes: 3