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

#copy_attribute_migration_templateObject

create migration



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

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

#inject_puret_config_into_modelObject

configure puret attributes in model



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

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