Class: KonoUtilsBootstrapView4::ConceptGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveSupport::Inflector
Defined in:
lib/generators/kono_utils_bootstrap_view4/concept/concept_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_templatesObject



61
62
63
64
65
66
67
68
# File 'lib/generators/kono_utils_bootstrap_view4/concept/concept_generator.rb', line 61

def copy_templates
  if options.field_selector
    template 'forms/field_selector.template', File.join(path, "cell", "forms", "field_selector.rb")
  end
  if options.form
    template 'form.template', File.join(path, "cell", "form.rb")
  end
end

#generate_foldersObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/generators/kono_utils_bootstrap_view4/concept/concept_generator.rb', line 14

def generate_folders

  if safe_constantize(model_name)
    FileUtils.mkdir_p(File.join(path, 'cell'))
    FileUtils.mkdir_p(File.join(path, 'view'))
  else
    puts "Modello inesistente"
  end

end