Class: Mailkick::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Mailkick::Generators::InstallGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/generators/mailkick/install_generator.rb
Instance Method Summary collapse
- #copy_migration ⇒ Object
- #foreign_key_type ⇒ Object
- #key_type ⇒ Object
- #migration_version ⇒ Object
- #primary_key_type ⇒ Object
Instance Method Details
#copy_migration ⇒ Object
10 11 12 |
# File 'lib/generators/mailkick/install_generator.rb', line 10 def copy_migration migration_template "install.rb", "db/migrate/create_mailkick_subscriptions.rb", migration_version: migration_version end |
#foreign_key_type ⇒ Object
22 23 24 |
# File 'lib/generators/mailkick/install_generator.rb', line 22 def foreign_key_type ", type: :#{key_type}" if key_type end |
#key_type ⇒ Object
26 27 28 |
# File 'lib/generators/mailkick/install_generator.rb', line 26 def key_type Rails.configuration.generators..dig(:active_record, :primary_key_type) end |
#migration_version ⇒ Object
14 15 16 |
# File 'lib/generators/mailkick/install_generator.rb', line 14 def migration_version "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]" end |
#primary_key_type ⇒ Object
18 19 20 |
# File 'lib/generators/mailkick/install_generator.rb', line 18 def primary_key_type ", id: :#{key_type}" if key_type end |