Class: ActiveRecord::Generators::CloudfujiGenerator

Inherits:
Base
  • Object
show all
Includes:
Cloudfuji::Generators::OrmHelpers
Defined in:
lib/generators/active_record/cloudfuji_generator.rb

Instance Method Summary collapse

Methods included from Cloudfuji::Generators::OrmHelpers

#model_contents, #model_exists?, #model_path

Instance Method Details

#copy_cloudfuji_migrationObject



16
17
18
# File 'lib/generators/active_record/cloudfuji_generator.rb', line 16

def copy_cloudfuji_migration
  migration_template "migration.rb", "db/migrate/cloudfuji_create_#{table_name}"
end

#generate_modelObject



12
13
14
# File 'lib/generators/active_record/cloudfuji_generator.rb', line 12

def generate_model
  invoke "active_record:model", [name], :migration => false unless model_exists?
end

#inject_cloudfuji_contentObject



20
21
22
23
24
25
# File 'lib/generators/active_record/cloudfuji_generator.rb', line 20

def inject_cloudfuji_content
  inject_into_class model_path, class_name, model_contents + <<-CONTENT
  # Setup accessible (or protected) attributes for your model
  attr_accessible :cloudfuji_id, :cloudfuji_version
CONTENT
end