Class: Stager::ScaffoldGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Stager::ScaffoldGenerator
- Defined in:
- lib/generators/stager/scaffold/scaffold_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_controller ⇒ Object
38 39 40 |
# File 'lib/generators/stager/scaffold/scaffold_generator.rb', line 38 def create_controller invoke "stager:controller", [scaffold_name.pluralize, model_and_controller_args, option?(:namespaced_model), option?(:skip_views), option?(:skip_helper)] end |
#create_model ⇒ Object
32 33 34 35 36 |
# File 'lib/generators/stager/scaffold/scaffold_generator.rb', line 32 def create_model unless @skip_model invoke "stager:model", [namespaced_scaffold_name?, model_attributes, option?(:skip_migration), option?(:skip_timestamps)] end end |
#create_presenter ⇒ Object
42 43 44 45 46 |
# File 'lib/generators/stager/scaffold/scaffold_generator.rb', line 42 def create_presenter unless [:skip_presenter] invoke "exhibit:presenter", [scaffold_name, [:namespaced_model] ? nil : "--no_namespace"] end end |
#set_options ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/stager/scaffold/scaffold_generator.rb', line 16 def @model_attributes = [] @invert_actions = false @skip_model = false model_and_controller_args.each do |arg| if arg.include?(':') @model_attributes << arg end end if @model_attributes.empty? @skip_model = true end end |