Pretty simple I’m sure… but I can’t figure out why it wouldn’t work.
<tr<% if film.viewed == true %> class="viewed"<% end %>>
The film.viewed is a boolean but its not rendering the class if its true. Probably a syntax error. Any help? Also is there an easier way to write this without opening and closing? I tried using:
<tr<% if film.viewed == true puts class=\"viewed\" end %>>
Again probably a syntax error. I’m coming from PHP so I’m still learning.
Thanks.
Your best bet would be something like the following…
All boolean ActiveRecord columns get a question mark method that will return a true or false. As MySQL stores booleans as 1/0, I usually use the question mark method just to be safe.