Quee WM wrote:
> I have 34 boolean columns in my table related to a product.
> 
> I need to present this information in a table format with the column
> header and the corresponding value set to yes or no depending on the
> boolean value. The end product (i.e. the resulting html code) will be
> sent as CDATA in an xml feed. and the same process will have to be
> repeated again for each product in the database table.
> 
> What is the best way to test and then add the correct value without
> having to write 34 different if statements?

Override Boolean#to_s so that it produces the desired output.

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
Posted via http://www.ruby-forum.com/.
-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to