Adv. Rails Recipes - Select List CSS Style

I’m using CSS to style form based on the Advanced Rails Recipe #22 for
DRY forms. Everything is working great. The only exception is the
select lists.

To generate all of the fields, I only need to put in this line:

<%= f.text_field :name %>


<%= f.check_box :is_active %>

And it generates the label and the field.

This doesn’t work the same way for the select lists.

Currently I have this:
<%= :is_active, [ [‘True’, true],[‘False’, false] ], {}, :label
=> ‘Is Active’ %>

But it does not generate a label to go with the field. Does anyone have
experience using this recipe and creating select lists?


haven’t used that recipe. However I assume it involves over riding form
methods so as to include the tag, you can do this with

f.label :is_active

For all of the other types of fields, I can simply add the label tag in
the tag so that it looks like this:

<%= f.text_field :is_active, :label => ‘Is Active’ %>

But this doesn’t appear to work for this

<%= :is_active, [ [‘True’, true],[‘False’, false] ], {}, :label
=> ‘Is Active’ %>

Spoke too soon - that’s didn’t work.

Figured it out… the {} is the options hash and by removing the
brackets, it recognized the label.
<%= :is_active, [ [‘True’, true],[‘False’, false] ], :label
=> ‘Is Active’ %>