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



29
30
31
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 29

def from_table
  @from_table
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



29
30
31
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 29

def options
  @options
end

#to_tableObject

Returns the value of attribute to_table

Returns:

  • (Object)

    the current value of to_table



29
30
31
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 29

def to_table
  @to_table
end

Instance Method Details

#columnObject



34
35
36
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 34

def column
  options[:column]
end

#custom_primary_key?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 50

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

#defined_for?(options_or_to_table = {}) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
57
58
59
60
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 54

def defined_for?(options_or_to_table = {})
  if options_or_to_table.is_a?(Hash)
    options_or_to_table.all? {|key, value| options[key].to_s == value.to_s }
  else
    to_table == options_or_to_table.to_s
  end
end

#nameObject



30
31
32
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 30

def name
  options[:name]
end

#on_deleteObject



42
43
44
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 42

def on_delete
  options[:on_delete]
end

#on_updateObject



46
47
48
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 46

def on_update
  options[:on_update]
end

#primary_keyObject



38
39
40
# File 'lib/active_record/connection_adapters/abstract/schema_definitions.rb', line 38

def primary_key
  options[:primary_key] || default_primary_key
end