# Scaffold for boolean fields

**URL:** <https://www.ruby-forum.com/t/scaffold-for-boolean-fields/119391>\
**Category:** Rails\
**Created:** [November 6, 2007, 6:07pm UTC](https://www.ruby-forum.com/t/scaffold-for-boolean-fields/119391 "2007-11-06T18:07:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bhaskar\_Jayakrishna](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@Bhaskar\_Jayakrishna](https://www.ruby-forum.com/u/Bhaskar_Jayakrishna)\
**Post date:** [November 6, 2007, 6:07pm UTC](https://www.ruby-forum.com/t/scaffold-for-boolean-fields/119391/1 "2007-11-06T18:07:33Z")

</div>

The default scaffold generator generates the following code for a  
boolean field. This results in a past selection not being remembered  
during edits.

Active

 False True

I guess it should be:  
Active  
\<%= select(“model”, “active”, [[‘True’, true],[‘False’, false]]) %\>

This seems to be a rather basic operation for the scaffolding  
generator to get wrong. Am I missing something?

- bhaskar

---

<div class="post-metadata">

**Author:** ![Bhaskar\_Jayakrishna](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@Bhaskar\_Jayakrishna](https://www.ruby-forum.com/u/Bhaskar_Jayakrishna)\
**Post date:** [November 6, 2007, 6:09pm UTC](https://www.ruby-forum.com/t/scaffold-for-boolean-fields/119391/2 "2007-11-06T18:09:18Z")

</div>

FYI: I am using Rails 1.2.5 (through InstantRails + update).

---

<div class="post-metadata">

**Author:** ![Bhaskar\_Jayakrishna](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@Bhaskar\_Jayakrishna](https://www.ruby-forum.com/u/Bhaskar_Jayakrishna)\
**Post date:** [November 6, 2007, 6:19pm UTC](https://www.ruby-forum.com/t/scaffold-for-boolean-fields/119391/3 "2007-11-06T18:19:50Z")

</div>

First off:

Yes, it’s basic. Because scaffolding is basic. It’s also not meant for  
production use.

Second, people like the scaffolding because it builds forms for them 🙂

I just released a gem called scaffold\_form\_generator that does the form  
generation part of scaffolding (no controller, no model, just the form).  
It’s really meant for use in Rails 2.0 apps though since it uses RESTful  
routing and the new .html.erb syntax for forms.

You can learn more about that at [http://scaffoldform.rubyforge.org](http://scaffoldform.rubyforge.org)

I prefer checkboxes for booleans… it’s quicker and just makes more  
sense  
from a usability standpoint.

\<%=check\_box :model, :active %\>

When you generate a form with scaffold\_form\_generator, that’s what you  
get.  
🙂

If you’re looking for something more advanced than scaffolding, look at  
ActiveScaffold or Streamlined, two very nice projects that take  
scaffolding  
to a whole new level, one that could be used in production (though I  
still  
think you should code your own user interfaces, but I’m an HTML guy at  
heart.)
