Class: ActiveRecord::ConnectionAdapters::ForeignKeyDefinition

Inherits:
Struct
  • Object
show all
Defined in:
lib/active_record/connection_adapters/abstract/schema_definitions.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#from_tableObject

Returns the value of attribute from_table

Returns:

  • (Object)

    the current value of from_table



74
75
76
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 74

def from_table
  @from_table
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



74
75
76
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 74

def options
  @options
end

#to_tableObject

Returns the value of attribute to_table

Returns:

  • (Object)

    the current value of 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

#columnObject



79
80
81
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 79

def column
  options[:column]
end

#custom_primary_key?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 95

def custom_primary_key?
  options[:primary_key] != default_primary_key
end

#defined_for?(to_table_ord = nil, to_table: nil, **options) ⇒ Boolean

Returns:

  • (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, **options)
  if to_table_ord
    self.to_table == to_table_ord.to_s
  else
    (to_table.nil? || to_table.to_s == self.to_table) &&
      options.all? { |k, v| self.options[k].to_s == v.to_s }
  end
end

#nameObject



75
76
77
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 75

def name
  options[:name]
end

#on_deleteObject



87
88
89
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 87

def on_delete
  options[:on_delete]
end

#on_updateObject



91
92
93
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 91

def on_update
  options[:on_update]
end

#primary_keyObject



83
84
85
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 83

def primary_key
  options[:primary_key] || default_primary_key
end

#validate?Boolean Also known as: validated?

Returns:

  • (Boolean)


99
100
101
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 99

def validate?
  options.fetch(:validate, true)
end