method

find_record_by_id

rails latest stable - Class: ActiveRecord::NestedAttributes

Method not available on this version

This method is only available on newer versions. The first available version (v7.2.3) is shown here.

find_record_by_id(records, id)
private

No documentation available.

# File activerecord/lib/active_record/nested_attributes.rb, line 624
      def find_record_by_id(records, id)
        return if records.empty?

        if records.first.class.composite_primary_key?
          id = Array(id).map(&:to_s)
          records.find { |record| Array(record.id).map(&:to_s) == id }
        else
          records.find { |record| record.id.to_s == id.to_s }
        end
      end