Class: ActiveRecord::Generators::ModelGenerator

Inherits:
Base
  • Object
show all
Includes:
Ixtlan::Generators::Singleton
Defined in:
lib/generators/rails/active_record/active_record_generator.rb

Instance Method Summary collapse

Methods included from Ixtlan::Generators::Singleton

included

Instance Method Details

#create_migration_fileObject



20
21
22
23
# File 'lib/generators/rails/active_record/active_record_generator.rb', line 20

def create_migration_file
  return unless options[:migration] && options[:parent].nil?
  migration_template "migration.rb", "db/migrate/create_#{table_name}.rb"
end

#create_model_fileObject



25
26
27
# File 'lib/generators/rails/active_record/active_record_generator.rb', line 25

def create_model_file
  template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
end

#create_module_fileObject



29
30
31
32
# File 'lib/generators/rails/active_record/active_record_generator.rb', line 29

def create_module_file
  return if class_path.empty?
  template 'module.rb', File.join('app/models', "#{class_path.join('/')}.rb") if behavior == :invoke
end