method
extract_associated
v7.0.0 -
Show latest stable
- 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)