Class: Followability::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/followability/generators/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_migrationObject



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_commandObject



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_destinationObject



27
28
29
# File 'lib/followability/generators/install_generator.rb', line 27

def locale_destination
  'config/locales/followability.en.yml'
end

#locale_sourceObject



23
24
25
# File 'lib/followability/generators/install_generator.rb', line 23

def locale_source
  File.expand_path('../../../config/locales/en.yml', __dir__)
end

#migration_argsObject



35
36
37
# File 'lib/followability/generators/install_generator.rb', line 35

def migration_args
  [migration_name].concat(fields_command)
end

#migration_nameObject



31
32
33
# File 'lib/followability/generators/install_generator.rb', line 31

def migration_name
  'CreateFollowabilityRelationships'
end