Class: DataMapper::Generators::ModelGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/data_mapper/model/model_generator.rb

Instance Attribute Summary

Attributes included from Rails3Generators::MigrationHelper

#migration_number

Instance Method Summary collapse

Methods inherited from Base

source_root

Methods included from Rails3Generators::MigrationHelper

included, #run_migration

Instance Method Details

#create_migration_fileObject



15
16
17
18
19
20
# File 'lib/generators/data_mapper/model/model_generator.rb', line 15

def create_migration_file
  if migration? && parent?
    file_name = "create_#{file_path.gsub(/\//, '_').pluralize}"
    migration_template "migration.rb", "db/migrate/#{file_name}.rb"
  end
end

#create_model_fileObject



22
23
24
# File 'lib/generators/data_mapper/model/model_generator.rb', line 22

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