#primary_key_type (private)
[ GitHub ]# File 'activerecord/lib/rails/generators/active_record/migration.rb', line 20
def primary_key_type key_type = [:primary_key_type] ", id: :#{key_type}" if key_type end
123456789_123456789_123456789_123456789_123456789_
| Relationships & Source Files | |
| Namespace Children | |
|
Modules:
| |
| Extension / Inclusion / Inheritance Descendants | |
|
Included In:
| |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
::ActiveSupport::Concern
|
|
|
Instance Chain:
|
|
| Defined in: | activerecord/lib/rails/generators/active_record/migration.rb |
::ActiveSupport::Concern - Extended| class_methods | Define class methods from given block. |
| included | Evaluate given block in context of base class, so that you can write class macros here. |
| prepended | Evaluate given block in context of base class, so that you can write class macros here. |
| append_features, prepend_features | |
::Rails::Generators::Migration - Included::Rails::Generators::Migration - Included| #create_migration, | |
| #migration_template | Creates a migration template at the given destination. |
| #set_migration_assigns! | |
# File 'activerecord/lib/rails/generators/active_record/migration.rb', line 42
def configured_migrate_path return unless database = [:database] config = ActiveRecord::Base.configurations.configs_for( env_name: Rails.env, name: database ) Array(config&.migrations_paths).first end
# File 'activerecord/lib/rails/generators/active_record/migration.rb', line 30
def db_migrate_path if defined?(Rails.application) && Rails.application configured_migrate_path || default_migrate_path else "db/migrate" end end
# File 'activerecord/lib/rails/generators/active_record/migration.rb', line 38
def default_migrate_path Rails.application.config.paths["db/migrate"].to_ary.first end
# File 'activerecord/lib/rails/generators/active_record/migration.rb', line 25
def foreign_key_type key_type = [:primary_key_type] ", type: :#{key_type}" if key_type end
# File 'activerecord/lib/rails/generators/active_record/migration.rb', line 20
def primary_key_type key_type = [:primary_key_type] ", id: :#{key_type}" if key_type end