method

add_join_records

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: FixtureSet

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v5.2.3) is shown here.

These similar methods exist in v7.1.3.2:

add_join_records(rows, row, association) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/fixtures.rb, line 748
      def add_join_records(rows, row, association)
        # This is the case when the join table has no fixtures file
        if (targets = row.delete(association.name.to_s))
          table_name  = association.join_table
          column_type = association.primary_key_type
          lhs_key     = association.lhs_key
          rhs_key     = association.rhs_key

          targets = targets.is_a?(Array) ? targets : targets.split(/\s*,\s*/)
          rows[table_name].concat targets.map { |target|
            { lhs_key => row[primary_key_name],
              rhs_key => ActiveRecord::FixtureSet.identify(target, column_type) }
          }
        end
      end
Register or log in to add new notes.