instance method
cast_primary_key
Ruby on Rails 8.1.4
Since v8.1.4 Private — implementation detail, not part of the public APIAvailable in: v8.1.4 edge
Signature
cast_primary_key(id)
No documentation comment.
Parameters
-
idreq
Source
# File activerecord/lib/active_record/relation/finder_methods.rb, line 589
def cast_primary_key(id)
if model.composite_primary_key?
primary_key.zip(id).map! { |attr, value| model.type_for_attribute(attr).cast(value) }
else
model.type_for_attribute(primary_key).cast(id)
end
end
Defined in activerecord/lib/active_record/relation/finder_methods.rb line 589
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::FinderMethods