Class: Followability::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Followability::Generators::InstallGenerator
- Defined in:
- lib/followability/generators/install_generator.rb
Instance Method Summary collapse
- #create_migration ⇒ Object
- #fields_command ⇒ Object
- #locale_destination ⇒ Object
- #locale_source ⇒ Object
- #migration_args ⇒ Object
- #migration_name ⇒ Object
Instance Method Details
#create_migration ⇒ Object
10 11 12 13 |
# File 'lib/followability/generators/install_generator.rb', line 10 def create_migration invoke 'migration', migration_args copy_file locale_source, locale_destination end |
#fields_command ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/followability/generators/install_generator.rb', line 15 def fields_command %w[ followerable:belongs_to{polymorphic} followable:belongs_to{polymorphic} status:integer ] end |
#locale_destination ⇒ Object
27 28 29 |
# File 'lib/followability/generators/install_generator.rb', line 27 def locale_destination 'config/locales/followability.en.yml' end |
#locale_source ⇒ Object
23 24 25 |
# File 'lib/followability/generators/install_generator.rb', line 23 def locale_source File.('../../../config/locales/en.yml', __dir__) end |
#migration_args ⇒ Object
35 36 37 |
# File 'lib/followability/generators/install_generator.rb', line 35 def migration_args [migration_name].concat(fields_command) end |
#migration_name ⇒ Object
31 32 33 |
# File 'lib/followability/generators/install_generator.rb', line 31 def migration_name 'CreateFollowabilityRelationships' end |