khiav223577 / deep_pluck

Allow you to pluck attributes from nested associations without loading a bunch of records.
MIT License
460 stars 14 forks source link

Support deep_pluck at active model #19

Closed khiav223577 closed 6 years ago

khiav223577 commented 6 years ago

https://github.com/khiav223577/deep_pluck/issues/17

Usage

user = User.find_by(:name => %w(Pearl))
user.deep_pluck(:name, :posts => [:name]))
# => {'name' => 'Pearl' , :posts => [{'name' => "post4"}, {'name' => "post5"}]}