The previous chapter showed how Rails makes it easy to create simple applications using scaffolding, but a key aspect of Rails scaffolding is that it isn’t meant to be permanent. This doesn’t necessarily mean that you’ll tear it down completely and start over, but it usually means that you’ll at least make substantial improvements to make it more attractive. This is especially important where information is coming in from users. While Rails scaffolding provides basic functionality, you’re very likely going to want to improve on the forms it creates.
To demonstrate a reasonably complete set of HTML form features, the application needs to support more than one data field and needs to support fields in a variety of different types. Rails, because it works with a wide variety of databases, supports a narrower set of types than each of those databases. The types of fields that Rails supports through ActiveRecord include:
:string :text :integer :float :decimal :datetime :timestamp :time :date :binary :boolean
type is generally limited to 255 characters, whereas
:text can hold longer data. The
types all hold numbers, although integers may not have
a fractional part to the right of the decimal point. The
:date types hold the classically complicated combination values
used to represent dates and times. The
:binary type can hold unstructured binary data, ...