Class: AwsRecord::Generators::ModelGenerator
- Inherits:
-
Base
- Object
- Rails::Generators::NamedBase
- Base
- AwsRecord::Generators::ModelGenerator
- Defined in:
- lib/generators/aws_record/model/model_generator.rb
Instance Attribute Summary
Attributes inherited from Base
#gsi_rw_units, #gsis, #length_validations, #primary_read_units, #primary_write_units, #required_attrs
Instance Method Summary collapse
- #create_model ⇒ Object
- #create_table_config ⇒ Object
-
#initialize(args, *options) ⇒ ModelGenerator
constructor
A new instance of ModelGenerator.
Constructor Details
#initialize(args, *options) ⇒ ModelGenerator
Returns a new instance of ModelGenerator.
8 9 10 11 |
# File 'lib/generators/aws_record/model/model_generator.rb', line 8 def initialize(args, *) self.class.source_root File.('templates', __dir__) super end |
Instance Method Details
#create_model ⇒ Object
13 14 15 |
# File 'lib/generators/aws_record/model/model_generator.rb', line 13 def create_model template 'model.erb', File.join('app/models', class_path, "#{file_name}.rb") end |
#create_table_config ⇒ Object
17 18 19 20 21 22 |
# File 'lib/generators/aws_record/model/model_generator.rb', line 17 def create_table_config return unless ['table_config'] template 'table_config.erb', File.join('db/table_config', class_path, "#{file_name}_config.rb") end |