Class: Puret::Generators::ModelGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/puret/model/model_generator.rb

Instance Method Summary collapse

Methods inherited from Base

#invoke_model, next_migration_number, source_root

Instance Method Details

#copy_migration_templateObject

create migration



23
24
25
# File 'lib/generators/puret/model/model_generator.rb', line 23

def copy_migration_template
  migration_template "migration.rb", "db/migrate/create_#{translations_table_name}"
end

#copy_model_templateObject

create model



11
12
13
# File 'lib/generators/puret/model/model_generator.rb', line 11

def copy_model_template
  template "model.rb", translation_model_path
end

#inject_puret_config_into_modelObject

configure puret attributes in model



16
17
18
19
20
# File 'lib/generators/puret/model/model_generator.rb', line 16

def inject_puret_config_into_model
  inject_into_class model_path, class_name, "  puret \#{attributes.map { |a| \":%s\" % a.name }.join(\", \")}\n    CONTENT\nend\n"