Class: AlphaApi::Generators::ResourceGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/resource/resource_generator.rb

Instance Method Summary collapse

Instance Method Details

#generate_controller_fileObject



13
14
15
16
17
# File 'lib/generators/resource/resource_generator.rb', line 13

def generate_controller_file
  prefix = AlphaApi.application.settings.api_prefix
  @boilerplate = Boilerplate.new(class_name, prefix)
  template "controller.rb.erb", "app/controllers/#{prefix}/#{file_path.tr('/', '_').pluralize}_controller.rb"
end

#generate_serializer_fileObject



19
20
21
22
23
# File 'lib/generators/resource/resource_generator.rb', line 19

def generate_serializer_file
  prefix = AlphaApi.application.settings.api_prefix
  @boilerplate = Boilerplate.new(class_name, prefix)
  template "serializer.rb.erb", "app/serializers/#{prefix}/#{file_path.tr('/', '_')}_serializer.rb"
end