Class: Ahoy::Generators::Clicks::ActiverecordGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Ahoy::Generators::Clicks::ActiverecordGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/generators/ahoy/clicks/activerecord_generator.rb
Instance Method Summary collapse
Instance Method Details
#copy_migration ⇒ Object
10 11 12 |
# File 'lib/generators/ahoy/clicks/activerecord_generator.rb', line 10 def copy_migration migration_template "migration.rb", "db/migrate/create_ahoy_clicks.rb", migration_version: migration_version end |
#key_type ⇒ Object
22 23 24 |
# File 'lib/generators/ahoy/clicks/activerecord_generator.rb', line 22 def key_type Rails.configuration.generators..dig(:active_record, :primary_key_type) end |
#migration_version ⇒ Object
14 15 16 |
# File 'lib/generators/ahoy/clicks/activerecord_generator.rb', line 14 def migration_version "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]" end |
#primary_key_type ⇒ Object
18 19 20 |
# File 'lib/generators/ahoy/clicks/activerecord_generator.rb', line 18 def primary_key_type ", id: :#{key_type}" if key_type end |