class method self.composite_identify

Ruby on Rails 8.0.4

Since v7.1.6

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

self.composite_identify(label, key)

Returns a consistent, platform-independent hash representing a mapping between the label and the subcomponents of the provided composite key.

Example:

composite_identify("label", [:a, :b, :c]) # => { a: hash_1, b: hash_2, c: hash_3 }

Parameters

label req
key req
Source
# File activerecord/lib/active_record/fixtures.rb, line 633
      def composite_identify(label, key)
        key
          .index_with
          .with_index { |sub_key, index| (identify(label) << index) % MAX_ID }
          .with_indifferent_access
      end

Defined in activerecord/lib/active_record/fixtures.rb line 633 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::FixtureSet

Type at least 2 characters to search.

↑↓ navigate · open · esc close