Class: Stager::ModelGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Stager::ModelGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/stager/model/model_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_migration ⇒ Object
31 32 33 34 35 |
# File 'lib/generators/stager/model/model_generator.rb', line 31 def create_migration unless [:skip_migration] migration_template 'migration.rb', "db/migrate/create_#{model_path.pluralize.gsub('/', '_')}.rb" end end |
#create_model ⇒ Object
24 25 26 27 28 29 |
# File 'lib/generators/stager/model/model_generator.rb', line 24 def create_model template 'model.rb', "app/models/#{model_path}.rb" template "spec/model.rb", "spec/models/#{model_path}_spec.rb" template 'spec/fixtures.yml', "spec/fixtures/#{model_path.pluralize}.yml" end |
#set_options ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/generators/stager/model/model_generator.rb', line 16 def @model_attributes = [] model_args.each do |arg| @model_attributes << Rails::Generators::GeneratedAttribute.new(*arg.split(':')) end end |