Class: RestApiGenerator::ResourceGenerator

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

Constant Summary

Constants included from Helpers

Helpers::API_CONTROLLER_DIR_PATH, Helpers::API_DOCS_DIR_PATH, Helpers::API_TEST_DIR_PATH

Instance Attribute Summary

Attributes included from Helpers

#attributes, #options

Instance Method Summary collapse

Instance Method Details

#create_service_fileObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/generators/rest_api_generator/resource_generator.rb', line 18

def create_service_file
  create_model_files

  template controller_template, controller_path

  # Routes
  if options["scope"].blank? && options["father"].blank?
    route "resources :#{file_name.pluralize}"
  else
    log("You need to manually setup routes files for nested or scoped resource")
  end
end