Class: DataMapper::Generators::ModelGenerator
- Inherits:
-
Base
- Object
- Rails::Generators::NamedBase
- Base
- DataMapper::Generators::ModelGenerator
- Defined in:
- lib/generators/data_mapper/model/model_generator.rb
Instance Attribute Summary
Attributes included from Rails3Generators::MigrationHelper
Instance Method Summary collapse
Methods inherited from Base
Methods included from Rails3Generators::MigrationHelper
Instance Method Details
#create_migration_file ⇒ Object
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_file ⇒ Object
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 |