method

extract_associated

Importance_1
v6.1.7.7 - Show latest stable - 0 notes - Class: ActiveRecord::QueryMethods
extract_associated(association) public

Extracts a named association from the relation. The named association is first preloaded, then the individual association records are collected from the relation. Like so:

account.memberships.extract_associated(:user)
# => Returns collection of User records

This is short-hand for:

account.memberships.preload(:user).collect(&:user)
Show source
Register or log in to add new notes.