instance method cast_primary_key

Ruby on Rails 8.1.4

Since v8.1.4 Private — implementation detail, not part of the public API

Available in: v8.1.4 edge

Signature

cast_primary_key(id)

No documentation comment.

Parameters

id req
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

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close