Module: ActiveRecord::Postgres::Constraints
- Defined in:
- lib/active_record/postgres/constraints.rb,
lib/active_record/postgres/constraints/railtie.rb,
lib/active_record/postgres/constraints/version.rb,
lib/active_record/postgres/constraints/types/check.rb,
lib/active_record/postgres/constraints/schema_dumper.rb,
lib/active_record/postgres/constraints/types/exclude.rb,
lib/active_record/postgres/constraints/schema_creation.rb,
lib/active_record/postgres/constraints/command_recorder.rb,
lib/active_record/postgres/constraints/table_definition.rb,
lib/active_record/postgres/constraints/postgresql_adapter.rb
Defined Under Namespace
Modules: CommandRecorder, PostgreSQLAdapter, SchemaCreation, SchemaDumper, TableDefinition, Types
Classes: Railtie
Constant Summary
collapse
- CONSTRAINT_TYPES =
{
check: 'c',
exclude: 'x',
}.freeze
- VERSION =
'0.2.2'
Class Method Summary
collapse
Class Method Details
.class_for_constraint_type(type) ⇒ Object
11
12
13
14
|
# File 'lib/active_record/postgres/constraints.rb', line 11
def self.class_for_constraint_type(type)
'ActiveRecord::Postgres::Constraints::Types::'\
"#{type.to_s.classify}".constantize
end
|
.normalize_name_and_conditions(table, name_or_conditions, conditions) ⇒ Object
16
17
18
19
20
|
# File 'lib/active_record/postgres/constraints.rb', line 16
def self.normalize_name_and_conditions(table, name_or_conditions, conditions)
return [name_or_conditions, conditions] if conditions
["#{table}_#{Time.zone.now.nsec}", name_or_conditions]
end
|