Class: JsonVoorhees::MassiveScaffoldGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/json_voorhees/massive_scaffold/massive_scaffold_generator.rb

Instance Method Summary collapse

Instance Method Details

#sprintObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/generators/json_voorhees/massive_scaffold/massive_scaffold_generator.rb', line 9

def sprint
  inside "engines/#{module_name.underscore}" do
    # We should skip making the migration if this is not version 1
    # Chaned scaffold to model here, dont need the other routes
    if api_version != "1"
      run "rails g model #{resource_name} #{attributes.join(" ")} --no-migration "
    else
      run "rails g model #{resource_name} #{attributes.join(" ")}"
    end
    run "rails g json_voorhees:engine_scaffold #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
    correct_routes
  end
  run "rails g json_voorhees:app_scaffold #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
  #run "rails generate active_admin:resource #{module_name.underscore.downcase}::#{resource_name.singularize.underscore.downcase}"
  make_custom_active_admin

end