Class: Loco::ModelGenerator

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

Instance Method Summary collapse

Instance Method Details

#create_modelObject



4
5
6
7
8
9
10
# File 'lib/generators/loco/model/model_generator.rb', line 4

def create_model
  model_template = File.read find_in_source_paths('model.coffee')
  model_template.gsub! '#{name}', class_name
  model_template.gsub! '#{plural_name}', plural_name
  model_template.sub! '#{attributes}', attr_def
  create_file file_path, model_template
end