module ActiveRecord::AttributeMethods::PrimaryKey

def id?

Queries the primary key column's value.
def id?
  query_attribute(@primary_key)
end