Class: Docsmith::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/generators/docsmith/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_initializerObject



27
28
29
# File 'lib/generators/docsmith/install/install_generator.rb', line 27

def create_initializer
  template "docsmith_initializer.rb.erb", "config/initializers/docsmith.rb"
end

#create_migration_fileObject

NOTE: do not name this create_migration. Rails::Generators::Migration defines create_migration(destination, data, config) and migration_template calls it internally, so a same-named zero-arg action method shadows it and the generator dies with "wrong number of arguments (given 3, expected 0)". That is what happened in 0.1.0.



20
21
22
23
24
25
# File 'lib/generators/docsmith/install/install_generator.rb', line 20

def create_migration_file
  migration_template(
    "create_docsmith_tables.rb.erb",
    "db/migrate/create_docsmith_tables.rb"
  )
end