Class: Msip::TablabasicaGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/msip/tablabasica_generator.rb

Instance Method Summary collapse

Instance Method Details

#genera_tablabasicaObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/generators/msip/tablabasica_generator.rb', line 30

def genera_tablabasica
  if ENV["DISABLE_SPRING"].to_i != 1
    # http://makandracards.com/makandra/24525-disabling-spring-when-debugging
    puts "Ejecutar con DISABLE_SPRING=1"
    exit(1)
  end
  if tablabasica == tablabasicaplural
    puts <<~EOF
      El nombre en singular debe ser diferente al nombre en plural
      para que opere bien agregar registros a la tabla basica
    EOF
    exit(1)
  end
  genera_modelo if options.modelo
  genera_controlador if options.controlador
  genera_test if options.test
  genera_asociacion if options.asocia != ""
end