aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorGannon McGibbon <gannon.mcgibbon@gmail.com>2018-11-30 13:17:33 -0500
committerGannon McGibbon <gannon.mcgibbon@gmail.com>2018-11-30 13:25:42 -0500
commit220494185c84cf62d60ddcb1fa3527da9d758578 (patch)
tree0f77d4408b25f0c6f6eeeabc6b878048a1041d1e /activerecord
parentf6e1061c915a92389fee2819d29b13764942c985 (diff)
downloadrails-220494185c84cf62d60ddcb1fa3527da9d758578.tar.gz
rails-220494185c84cf62d60ddcb1fa3527da9d758578.tar.bz2
rails-220494185c84cf62d60ddcb1fa3527da9d758578.zip
Clarify no support for non PK id columns
[ci skip]
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/attribute_methods/primary_key.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/primary_key.rb b/activerecord/lib/active_record/attribute_methods/primary_key.rb
index 9b267bb7c0..6af5346fa7 100644
--- a/activerecord/lib/active_record/attribute_methods/primary_key.rb
+++ b/activerecord/lib/active_record/attribute_methods/primary_key.rb
@@ -14,38 +14,39 @@ module ActiveRecord
[key] if key
end
- # Returns the primary key value.
+ # Returns the primary key column's value.
def id
sync_with_transaction_state
primary_key = self.class.primary_key
_read_attribute(primary_key) if primary_key
end
- # Sets the primary key value.
+ # Sets the primary key column's value.
def id=(value)
sync_with_transaction_state
primary_key = self.class.primary_key
_write_attribute(primary_key, value) if primary_key
end
- # Queries the primary key value.
+ # Queries the primary key column's value.
def id?
sync_with_transaction_state
query_attribute(self.class.primary_key)
end
- # Returns the primary key value before type cast.
+ # Returns the primary key column's value before type cast.
def id_before_type_cast
sync_with_transaction_state
read_attribute_before_type_cast(self.class.primary_key)
end
- # Returns the primary key previous value.
+ # Returns the primary key column's previous value.
def id_was
sync_with_transaction_state
attribute_was(self.class.primary_key)
end
+ # Returns the primary key column's value from the database.
def id_in_database
sync_with_transaction_state
attribute_in_database(self.class.primary_key)