Ignat's blog

One of the most interesting features of Ruby on Rails that increase its popularity is undoubtedly built-in source code generator. This only feature saves a lot of typing, allows developers to add features to the framework, encourages creating new generators for repetitive tasks. In the end it saves a lot of time and effort.

Most of Ruby on Rails projects start from code generation. And code generation is used throughout the project to add new controllers, views and models. For example:

script/generate controller Product list new edit

creates stubs for your product controller and three views to list, to create new, or to update products. You can remove controllers and views with 'script/destroy' command. You can also ask Ruby on Rails generator to automatically add newly created files to a subversion repository. Sweet! But keep reading...