Saturday, March 10, 2007

See Rails MVC from data

The controller is protected from having to deal directly with the database. So are you. When you write Rails application code, you always write code that manipulates data through nicely named, neatly ordered variables. The code you write triggers a cascade of database operations. But you don’t have to address the database directly.

You have to design the database, and you have to know what the database tables and fields are called (because that knowledge has a direct bearing on what your model can do). But then you manipulate the database at an abstract level.

On the one hand, the controller has access to the universe of the models, through which it can manipulate data; and on the other hand, it has the ability to share data with the view template.

No comments: