Module: ActiveRecord::PGEnum
- Defined in:
- lib/active_record/pg_enum.rb,
lib/active_record/pg_enum/version.rb,
lib/active_record/pg_enum/6.1/create_enum.rb,
lib/active_record/pg_enum/command_recorder.rb,
lib/active_record/pg_enum/4.1/schema_dumper.rb,
lib/active_record/pg_enum/5.2/schema_dumper.rb,
lib/active_record/pg_enum/schema_statements.rb,
lib/active_record/pg_enum/4.1/migration_keys.rb,
lib/active_record/pg_enum/4.1/simplified_type.rb,
lib/active_record/pg_enum/4.1/table_definition.rb,
lib/active_record/pg_enum/4.2/table_definition.rb,
lib/active_record/pg_enum/6.0/table_definition.rb,
lib/active_record/pg_enum/6.1/postgresql_adapter.rb,
lib/active_record/pg_enum/4.1/initialize_type_map.rb,
lib/active_record/pg_enum/4.1/prepare_column_options.rb,
lib/active_record/pg_enum/5.0/prepare_column_options.rb,
lib/active_record/pg_enum/5.2/prepare_column_options.rb
Defined Under Namespace
Modules: CommandRecorder, CreateEnum, InitializeTypeMap, MigrationKeys, PostgreSQLAdapter, PrepareColumnOptions, SchemaDumper, SchemaStatements, SimplifiedType, TableDefinition
Constant Summary
collapse
- KNOWN_VERSIONS =
%w[4.1 4.2 5.0 5.1 5.2 6.0 6.1 7.0].map { |v| Gem::Version.new(v) }
- VERSION =
"2.0.0"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.enabled_version ⇒ Object
Returns the value of attribute enabled_version.
9
10
11
|
# File 'lib/active_record/pg_enum.rb', line 9
def enabled_version
@enabled_version
end
|
Class Method Details
.detected_version ⇒ Object
28
29
30
|
# File 'lib/active_record/pg_enum.rb', line 28
def detected_version
approximate_version Gem.loaded_specs["activerecord"].version
end
|
.install(version) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/active_record/pg_enum.rb', line 11
def install(version)
@enabled_version = approximate_version(version)
if !KNOWN_VERSIONS.include?(enabled_version) && enabled_version > KNOWN_VERSIONS.last
@enabled_version = KNOWN_VERSIONS.last
warn "[PGEnum] Current ActiveRecord version unsupported! Falling back to: #{enabled_version}"
end
initialize!
end
|
.register(patch, &block) ⇒ Object
24
25
26
|
# File 'lib/active_record/pg_enum.rb', line 24
def register(patch, &block)
monkeypatches[patch] = block
end
|