On Sat, Jan 9, 2010 at 4:49 AM, Quee WM <[email protected]> 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?
>

You can convert the 34 boolean columns to a single binary column.  Then
you should be able to store, update, and retrieve the individual bits.
You
might be able to find the following screencast useful:

http://railscasts.com/episodes/189-embedded-association

Good luck,

-Conrad


> --
> 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]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>
>
--
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