Class: Puret::Generators::AttributeGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/puret/attribute/attribute_generator.rb

Instance Method Summary (collapse)

Methods inherited from Base

#invoke_model, next_migration_number, source_root

Instance Method Details

- (Object) copy_attribute_migration_template

create migration



19
20
21
# File 'lib/generators/puret/attribute/attribute_generator.rb', line 19

def copy_attribute_migration_template
  migration_template "migration.rb", "db/migrate/add_#{translations_table_name}"
end

- (Object) inject_puret_config_into_model

configure puret attributes in model



11
12
13
# File 'lib/generators/puret/attribute/attribute_generator.rb', line 11

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