Marlin Pierce
Marlin Pierce

Reputation: 10079

Rails 3.1 generator, no Rails::Generators::Base

I'm using Rails 3.1 to re-write a generator.

The Rails guide says to start with the following example:

class InitializerGenerator < Rails::Generators::Base
  def create_initializer_file
    create_file "config/initializers/initializer.rb", "# Add initialization content here"
  end
end

However, the neither the Rails::Generators nor Rails::Generator namespace seem to be defined.

Is there a guide for Rails 3.1 generators?

Upvotes: 0

Views: 145

Answers (1)

Marlin Pierce
Marlin Pierce

Reputation: 10079

The answer is:

require 'rails/generators'

Upvotes: 1

Related Questions