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
88 89 90 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 88 def from_table @from_table end |
#options ⇒ Object
Returns the value of attribute options
88 89 90 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 88 def @options end |
#to_table ⇒ Object
Returns the value of attribute to_table
88 89 90 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 88 def to_table @to_table end |
Instance Method Details
#column ⇒ Object
93 94 95 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 93 def column [:column] end |
#custom_primary_key? ⇒ Boolean
109 110 111 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 109 def custom_primary_key? [:primary_key] != default_primary_key end |
#defined_for?(to_table: nil, validate: nil, **options) ⇒ Boolean
122 123 124 125 126 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 122 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
118 119 120 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 118 def export_name_on_schema_dump? !ActiveRecord::SchemaDumper.fk_ignore_pattern.match?(name) if name end |
#name ⇒ Object
89 90 91 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 89 def name [:name] end |
#on_delete ⇒ Object
101 102 103 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 101 def on_delete [:on_delete] end |
#on_update ⇒ Object
105 106 107 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 105 def on_update [:on_update] end |
#primary_key ⇒ Object
97 98 99 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 97 def primary_key [:primary_key] || default_primary_key end |
#validate? ⇒ Boolean Also known as: validated?
113 114 115 |
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 113 def validate? .fetch(:validate, true) end |