ActiveRecord::AttributeMethods::PrimaryKey

module ActiveRecord::AttributeMethods::PrimaryKey

Public Instance Methods

Returns the primary key value.

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