instance method
id
Ruby on Rails 5.2.8.1
Since v3.2.22.5Signature
id()
Returns the primary key value.
Source
# File activerecord/lib/active_record/attribute_methods/primary_key.rb, line 18
def id
sync_with_transaction_state
primary_key = self.class.primary_key
_read_attribute(primary_key) if primary_key
end
Defined in activerecord/lib/active_record/attribute_methods/primary_key.rb line 18
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::AttributeMethods::PrimaryKey