Class: ActiveRecord::Generators::FreemiumGenerator
Instance Method Summary
collapse
#migration_exists?, #migration_path, #model_contents, #model_exists?, #model_path
Instance Method Details
#copy_freemium_migration ⇒ Object
12
13
14
|
# File 'lib/generators/active_record/freemium_generator.rb', line 12
def copy_freemium_migration
migration_template "migrations/#{table_name}.rb", "db/migrate/freemium_create_#{table_name}"
end
|
#generate_model ⇒ Object
16
17
18
|
# File 'lib/generators/active_record/freemium_generator.rb', line 16
def generate_model
invoke "active_record:model", [name], :migration => false unless model_exists? && behavior == :invoke
end
|
#inject_freemium_content ⇒ Object
20
21
22
23
24
25
|
# File 'lib/generators/active_record/freemium_generator.rb', line 20
def inject_freemium_content
inject_into_class(model_path, class_name, model_contents + <<CONTENT) if model_exists?
# Setup accessible (or protected) attributes for your model
include Freemium::#{class_name}
CONTENT
end
|