Module

Rails::Generator::Lookup::ClassMethods

Inheritance

Methods

Instance

Visibility Signature
public append_sources (*args)
public instance (generator_name, args = [], runtime_options = {})
public lookup (generator_name)
public prepend_sources (*args)
public reset_sources ()
public sources ()
public use_application_sources! ()
public use_component_sources! ()

Instance Method Detail

append_sources(*args)

Add a source to the end of the list.

instance(generator_name, args = [], runtime_options = {})

Convenience method to lookup and instantiate a generator.

lookup(generator_name)

Lookup knows how to find generators’ Specs from a list of Sources. Searches the sources, in order, for the first matching name.

prepend_sources(*args)

Add a source to the beginning of the list.

reset_sources()

Reset the source list.

sources()

The list of sources where we look, in order, for generators.

use_application_sources!()

Use application generators (app, ?).

use_component_sources!()

Use component generators (model, controller, etc).

  1. Rails application. If RAILS_ROOT is defined we know we‘re generating in the context of a Rails application, so search RAILS_ROOT/generators.
  2. Look in plugins, either for generators/ or rails_generators/ directories within each plugin
  3. User home directory. Search ~/.rails/generators.
  4. RubyGems. Search for gems named *_generator, and look for generators within any RubyGem‘s /rails_generators/<generator_name>_generator.rb file.
  5. Builtins. Model, controller, mailer, scaffold, and so on.