Class: ActiveRecord::ConnectionAdapters::ForeignKeyDefinition
- Defined in:
- activerecord/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?)
Methods inherited from Struct
Instance Attribute Details
#from_table ⇒ Object
Returns the value of attribute from_table
121 122 123 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 121 def from_table @from_table end |
#options ⇒ Object
Returns the value of attribute options
121 122 123 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 121 def @options end |
#to_table ⇒ Object
Returns the value of attribute to_table
121 122 123 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 121 def to_table @to_table end |
Instance Method Details
#column ⇒ Object
126 127 128 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 126 def column [:column] end |
#custom_primary_key? ⇒ Boolean
146 147 148 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 146 def custom_primary_key? [:primary_key] != default_primary_key end |
#deferrable ⇒ Object
142 143 144 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 142 def deferrable [:deferrable] end |
#defined_for?(to_table: nil, validate: nil, **options) ⇒ Boolean
159 160 161 162 163 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 159 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| self.[k].to_s == v.to_s } end |
#export_name_on_schema_dump? ⇒ Boolean
155 156 157 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 155 def export_name_on_schema_dump? !ActiveRecord::SchemaDumper.fk_ignore_pattern.match?(name) if name end |
#name ⇒ Object
122 123 124 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 122 def name [:name] end |
#on_delete ⇒ Object
134 135 136 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 134 def on_delete [:on_delete] end |
#on_update ⇒ Object
138 139 140 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 138 def on_update [:on_update] end |
#primary_key ⇒ Object
130 131 132 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 130 def primary_key [:primary_key] || default_primary_key end |
#validate? ⇒ Boolean Also known as: validated?
150 151 152 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 150 def validate? .fetch(:validate, true) end |