That sounds just right. Nifty, and perfectly suited, use of a helper.
- Aaron ''Jomdom'' Ransley
- Web: www.jomdom.net
- Mail: jomdom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
-----Original Message-----
From: rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On
Behalf Of Steve Ross
Sent: Thursday, August 04, 2005 3:33 PM
To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: [Rails] Separation of Logic & Presentation
Yet another question, as I begin to build my first Rails app out. I have a
sort of financial spreadsheet, and each line is rendered using
render_collection_of_partials. There are 7 fields that must be compared
against averages and displayed as red if below, green if above, or black if
smack on.
In my controller, I calculate the averages; however, I am looking for the
Rails best practice for achieving the coloring. It would seem something
like:
<%= show_tri_state value, :compare_to =>
@averages[''foo''], :when_below =>
''red'', :when_equal => ''black'',
:when_above => ''green'' %>
Which would yield:
<!-- assuming it was below average -->
<span class=''red''>whatever was in value</span>
Does this seem like overkill or too specific to merit a helper?
Thanks
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails