When a User checks off :good in the _form
<%= f.text_field :result_value %>
<%= f.date_select :date_value %>
<%= f.check_box :good %>
how can we render the font color in the index of that result (:result_value
& :date_value
) to green?
result.good
below pulls up true or false in the index. I'll take that out once we represent true or false with colors: true = green, false = red (default color).
<% averaged.results.each do |result| %>
<li>
<%= result.result_value %>
<%= result.date_value.strftime("%b %Y") %>
<%= result.good %>
</li>
<% end %>
.
class Result < ActiveRecord::Base
belongs_to :user
belongs_to :quantified
has_many :comments, as: :commentable
default_scope { order('date_value DESC') }
scope :good, -> { where(good: true) }
scope :good_count, -> { good.count }
end
Thank you so much for your help.
You could add a class to the LI based on the output?
Then in your css just set a colour for that class?