Class: Reativo::JsGenerator

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

Instance Method Summary collapse

Instance Method Details

#generate_operationsObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/generators/reativo/js_generator.rb', line 31

def generate_operations
  needs_form = false
  actions = options['actions'].empty? ? ['index', 'new', 'show', 'edit'] : options['actions']

  actions.each do |action|
    template "component/#{action.capitalize}.js", component_path(action)
    if needs_form?(action)
      needs_form = true
    end
  end

  if needs_form
    template "component/Form.js", component_path("Form")
  end
end