edge badge
Namespace
Methods
I
T
Instance Public methods
id()

Returns the primary key value.

# File activerecord/lib/active_record/attribute_methods/primary_key.rb, line 17
def id
  sync_with_transaction_state
  _read_attribute(self.class.primary_key) if self.class.primary_key
end
id=(value)

Sets the primary key value.

# File activerecord/lib/active_record/attribute_methods/primary_key.rb, line 23
def id=(value)
  sync_with_transaction_state
  _write_attribute(self.class.primary_key, value) if self.class.primary_key
end
id?()

Queries the primary key value.

# File activerecord/lib/active_record/attribute_methods/primary_key.rb, line 29
def id?
  sync_with_transaction_state
  query_attribute(self.class.primary_key)
end
id_before_type_cast()

Returns the primary key value before type cast.

# File activerecord/lib/active_record/attribute_methods/primary_key.rb, line 35
def id_before_type_cast
  sync_with_transaction_state
  read_attribute_before_type_cast(self.class.primary_key)
end
id_in_database()
# File activerecord/lib/active_record/attribute_methods/primary_key.rb, line 46
def id_in_database
  sync_with_transaction_state
  attribute_in_database(self.class.primary_key)
end
id_was()

Returns the primary key previous value.

# File activerecord/lib/active_record/attribute_methods/primary_key.rb, line 41
def id_was
  sync_with_transaction_state
  attribute_was(self.class.primary_key)
end
to_key()

Returns this record's primary key value wrapped in an array if one is available.

# File activerecord/lib/active_record/attribute_methods/primary_key.rb, line 11
def to_key
  key = id
  [key] if key
end