Class: ActiveRecord::Generators::BentoGenerator
Instance Method Summary
collapse
#bento_membership_exists?, #bento_membership_model_content, #bento_membership_path, #model_contents, #model_exists?, #model_path, #user_model_content, #user_path
Instance Method Details
#copy_bento_migration ⇒ Object
17
18
19
20
|
# File 'lib/generators/active_record/bento_generator.rb', line 17
def copy_bento_migration
migration_template "create_migration.rb", "db/migrate/bento_create_#{table_name}"
migration_template "bento_membership_migration.rb", "db/migrate/bento_create_bento_memberships"
end
|
#generate_model ⇒ Object
12
13
14
15
|
# File 'lib/generators/active_record/bento_generator.rb', line 12
def generate_model
invoke "active_record:model", [name], :migration => false unless model_exists?
create_file "app/models/bento_membership.rb", bento_membership_model_content
end
|
#inject_bento_content ⇒ Object
22
23
24
25
26
|
# File 'lib/generators/active_record/bento_generator.rb', line 22
def inject_bento_content
inject_into_class model_path, class_name, model_contents
inject_into_class user_path, "User", user_model_content
inject_into_class bento_membership_path, "BentoMembership", bento_membership_model_content
end
|