Class: Contai::Generators::ModelGenerator

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

Instance Method Summary collapse

Instance Method Details

#add_contai_to_modelObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/generators/contai/model_generator.rb', line 17

def add_contai_to_model
  model_file = "app/models/#{file_name}.rb"
  
  unless File.exist?(model_file)
    say "Model #{class_name} not found at #{model_file}", :red
    return
  end
  
  inject_into_class model_file, class_name do
    contai_configuration
  end
  
  say "Added Contai configuration to #{class_name}", :green
end