Ruby on Rails/Getting Started/Convention Over Configuration

Previous: Getting Started/Model-View-Controller Index Next: Getting Started/Creating the application

Convention over Configuration

edit

When starting to work with Rails you will find yourself looking at controllers and lots of views and models for your database. In order to reduce the need of heavy configuration, the team behind Rails has set up rules to ease up working with the application. These rules are not one-way. You may define your own rules but for the beginning (and for your further work, too) it's a good idea to stick to the conventions that Rails offers. These conventions will speed up development, keep your code concise and readable and - most important - these conventions allow you an easy navigation inside your application.

An example should show you how the conventions work together: You have a database table called orders with the primary key id. The matching model is called order and the controller, that handles all the logic is named orders_controller. The view is split in different actions: if the controller has a new and edit action, there is also a new- and edit-view.