Class: AwsRecord::Generators::ScaffoldControllerGenerator

Inherits:
Base
  • Object
show all
Includes:
Rails::Generators::ResourceHelpers
Defined in:
lib/generators/aws_record/scaffold_controller/scaffold_controller_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

Constructor Details

#initialize(args, *options) ⇒ ScaffoldControllerGenerator

Returns a new instance of ScaffoldControllerGenerator.



22
23
24
25
# File 'lib/generators/aws_record/scaffold_controller/scaffold_controller_generator.rb', line 22

def initialize(args, *options)
  options[0] << '--skip-table-config'
  super
end

Instance Method Details

#create_controller_filesObject



27
28
29
30
31
# File 'lib/generators/aws_record/scaffold_controller/scaffold_controller_generator.rb', line 27

def create_controller_files
  template_file = options.api? ? 'api_controller.rb' : 'controller.rb'
  template template_file,
           File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
end