Rails follows a Model-View-Controller (MVC) pattern in the code it generates. Application development then becomes a process of slowly modifying and replacing that auto-generated code to get the specialized functionality you want. With this file in place, you can run a command to generate a Rails scaffold, which is a set of auto-generated files that let you display, create, update, and delete database records using a set of Web pages. You can set up separate databases for development, testing, and production: development: With this in mind, the first code you write is a little file called database.yml that tells Rails how to connect to your database, so that it can set up all those intelligent defaults. With very few exceptions, the only time you need to write code in Rails is when your needs are different from the most common case. Because you have a database table called posts, and Rails hooks it all up for you. “Where does the variable come from, and how does it get filled with database records?” you might wonder. What this means in practice is that, instead of having to write a bunch of configuration files and standard boilerplate code for every project you undertake, you can simply code to a set of assumptions and all that grunt work will be done for you.Īs a result, the experience of examining Ruby on Rails code for the first time can be bewildering. Ruby on Rails is the poster child for a principle of agile development frameworks: convention over configuration. The following is republished from the Tech Times #128. But what about the code that you do have to write? Since yesterday’s post announcing Ruby on Rails 1.0, a lot of people have chimed in asking what it’s like when you get past the hype. Ruby on Rails got its reputation based on how little code you have to write to get common Web development tasks done.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |