v1.0.0 - Show latest stable - 0 notes - Superclass: Object

The base code generator is bare-bones. It sets up the source and destination paths and tells the logger whether to keep its trap shut. You’re probably looking for NamedBase, a subclass meant for generating "named" components such as models, controllers, and mailers.

Generators create a manifest of the actions they perform then hand the manifest to a command which replay the actions to do the heavy lifting. Create, destroy, and list commands are included. Since a single manifest may be used by any command, creating new generators is as simple as writing some code templates and declaring what you’d like to do with them.

The manifest method must be implemented by subclasses, returning a Rails::Generator::Manifest. The record method is provided as a convenience for manifest creation. Example:

  class EliteGenerator < Rails::Generator::Base
    def manifest
      record do |m|
        m.things(in) { here }
Show files where this class is defined (1 file)
Register or log in to add new notes.