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
- #deferrable ⇒ Object
- #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
123 124 125 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 123 def from_table @from_table end |
#options ⇒ Object
Returns the value of attribute options
123 124 125 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 123 def @options end |
#to_table ⇒ Object
Returns the value of attribute to_table
123 124 125 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 123 def to_table @to_table end |
Instance Method Details
#column ⇒ Object
128 129 130 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 128 def column [:column] end |
#custom_primary_key? ⇒ Boolean
148 149 150 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 148 def custom_primary_key? [:primary_key] != default_primary_key end |
#deferrable ⇒ Object
144 145 146 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 144 def deferrable [:deferrable] end |
#defined_for?(to_table: nil, validate: nil, **options) ⇒ Boolean
161 162 163 164 165 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 161 def defined_for?(to_table: nil, validate: nil, **) (to_table.nil? || to_table.to_s == self.to_table) && (validate.nil? || validate == self..fetch(:validate, validate)) && .all? { |k, v| Array(self.[k]).map(&:to_s) == Array(v).map(&:to_s) } end |
#export_name_on_schema_dump? ⇒ Boolean
157 158 159 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 157 def export_name_on_schema_dump? !ActiveRecord::SchemaDumper.fk_ignore_pattern.match?(name) if name end |
#name ⇒ Object
124 125 126 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 124 def name [:name] end |
#on_delete ⇒ Object
136 137 138 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 136 def on_delete [:on_delete] end |
#on_update ⇒ Object
140 141 142 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 140 def on_update [:on_update] end |
#primary_key ⇒ Object
132 133 134 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 132 def primary_key [:primary_key] || default_primary_key end |
#validate? ⇒ Boolean Also known as: validated?
152 153 154 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 152 def validate? .fetch(:validate, true) end |