AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Class: AwsRecord::Generators::ModelGenerator

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

Direct Known Subclasses

ResourceGenerator

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

Constructor Details

#initialize(args, *options) ⇒ ModelGenerator

Returns a new instance of ModelGenerator.



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

def initialize(args, *options)
  self.class.source_root File.expand_path('../templates', __FILE__)
  super
end

Instance Method Details

#create_modelObject



27
28
29
# File 'lib/generators/aws_record/model/model_generator.rb', line 27

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

#create_table_configObject



31
32
33
# File 'lib/generators/aws_record/model/model_generator.rb', line 31

def create_table_config
  template "table_config.rb", File.join("db/table_config", class_path, "#{file_name}_config.rb") if options["table_config"]
end