Class: ActiveRecord::ConnectionAdapters::ForeignKeyDefinition
- Inherits:
-
Struct
- Object
- Struct
- ActiveRecord::ConnectionAdapters::ForeignKeyDefinition
- Defined in:
- lib/active_record/connection_adapters/abstract/schema_definitions.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#from_table ⇒ Object
Returns the value of attribute from_table.
-
#options ⇒ Object
Returns the value of attribute options.
-
#to_table ⇒ Object
Returns the value of attribute to_table.
Instance Method Summary collapse
- #column ⇒ Object
- #custom_primary_key? ⇒ Boolean
- #defined_for?(to_table: nil, validate: nil, **options) ⇒ Boolean
- #export_name_on_schema_dump? ⇒ Boolean
- #name ⇒ Object
- #on_delete ⇒ Object
- #on_update ⇒ Object
- #primary_key ⇒ Object
- #validate? ⇒ Boolean (also: #validated?)
Instance Attribute Details
#from_table ⇒ Object
Returns the value of attribute from_table
78 79 80 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 78 def from_table @from_table end |
#options ⇒ Object
Returns the value of attribute options
78 79 80 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 78 def @options end |
#to_table ⇒ Object
Returns the value of attribute to_table
78 79 80 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 78 def to_table @to_table end |
Instance Method Details
#column ⇒ Object
83 84 85 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 83 def column [:column] end |
#custom_primary_key? ⇒ Boolean
99 100 101 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 99 def custom_primary_key? [:primary_key] != default_primary_key end |
#defined_for?(to_table: nil, validate: nil, **options) ⇒ Boolean
112 113 114 115 116 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 112 def defined_for?(to_table: nil, validate: nil, **) (to_table.nil? || to_table.to_s == self.to_table) && (validate.nil? || validate == .fetch(:validate, validate)) && .all? { |k, v| self.[k].to_s == v.to_s } end |
#export_name_on_schema_dump? ⇒ Boolean
108 109 110 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 108 def export_name_on_schema_dump? !ActiveRecord::SchemaDumper.fk_ignore_pattern.match?(name) if name end |
#name ⇒ Object
79 80 81 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 79 def name [:name] end |
#on_delete ⇒ Object
91 92 93 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 91 def on_delete [:on_delete] end |
#on_update ⇒ Object
95 96 97 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 95 def on_update [:on_update] end |
#primary_key ⇒ Object
87 88 89 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 87 def primary_key [:primary_key] || default_primary_key end |
#validate? ⇒ Boolean Also known as: validated?
103 104 105 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 103 def validate? .fetch(:validate, true) end |