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_ord = nil, to_table: nil, **options) ⇒ 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
74 75 76 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 74 def from_table @from_table end |
#options ⇒ Object
Returns the value of attribute options
74 75 76 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 74 def @options end |
#to_table ⇒ Object
Returns the value of attribute to_table
74 75 76 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 74 def to_table @to_table end |
Instance Method Details
#column ⇒ Object
79 80 81 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 79 def column [:column] end |
#custom_primary_key? ⇒ Boolean
95 96 97 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 95 def custom_primary_key? [:primary_key] != default_primary_key end |
#defined_for?(to_table_ord = nil, to_table: nil, **options) ⇒ Boolean
104 105 106 107 108 109 110 111 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 104 def defined_for?(to_table_ord = nil, to_table: nil, **) if to_table_ord self.to_table == to_table_ord.to_s else (to_table.nil? || to_table.to_s == self.to_table) && .all? { |k, v| self.[k].to_s == v.to_s } end end |
#name ⇒ Object
75 76 77 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 75 def name [:name] end |
#on_delete ⇒ Object
87 88 89 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 87 def on_delete [:on_delete] end |
#on_update ⇒ Object
91 92 93 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 91 def on_update [:on_update] end |
#primary_key ⇒ Object
83 84 85 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 83 def primary_key [:primary_key] || default_primary_key end |
#validate? ⇒ Boolean Also known as: validated?
99 100 101 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 99 def validate? .fetch(:validate, true) end |