instance method
add_join_records
Ruby on Rails 4.2.9
Since v4.1.16 Last seen in v5.2.8.1 PrivateSignature
add_join_records(rows, row, association)
No documentation comment.
Parameters
-
rowsreq -
rowreq -
associationreq
Source
# File activerecord/lib/active_record/fixtures.rb, line 719
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
Defined in activerecord/lib/active_record/fixtures.rb line 719
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::FixtureSet