Class: Familyable::RelationshipsGenerator
- Inherits:
-
Generator
- Object
- Rails::Generators::Base
- Generator
- Familyable::RelationshipsGenerator
- Defined in:
- lib/generators/familyable/relationships_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_class_name ⇒ Object
17 18 19 20 21 |
# File 'lib/generators/familyable/relationships_generator.rb', line 17 def add_class_name unless [:delete] gsub_file(relationship_model_path, "belongs_to :child", "belongs_to :child, class_name:\"#{clean_model_class_name}\"") end end |
#generate_relationships ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/generators/familyable/relationships_generator.rb', line 9 def generate_relationships if [:delete] system("bundle exec rails d model #{clean_relationship_class_name}") else generate "model", "#{clean_relationship_class_name} #{clean_model_base_name}:references child:references" end end |