Monday, February 19, 2007

rails

A Rails scaffold is an autogenerated framework for manipulating a model.
When we run the generator, we tell it that we want a scaffold for a particular
model (which it creates) and that we want to access it through a given
controller (which it also creates).

All scaffold-generated applications use the stylesheet scaffold.css in the
directory public/stylesheets.

The scaffold generator automatically makes use of Rails’ built-in
pagination helper. This breaks the lists of products into pages of 10 entries
each and automatically handles navigation between pages

In Rails, a model is automatically mapped to a database table whose name is the plural form of the model’s class.


The model layer is the gatekeeper between the world of code and the
database. Nothing to do with our application comes out of the database or
gets stored back into the database that doesn’t first go through the model.
This makes it an ideal place to put all validation; it doesn’t matter whether
the data comes from a form or from some programmatic manipulation in
our application. If the model checks it before writing to the database, then
the database will be protected from bad data.

No comments: