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

#deep_pluck at active model without plucking deeply will cause ArgumentError #22

Closed khiav223577 closed 6 years ago

khiav223577 commented 6 years ago

(The PR that supporting #deep_pluck at active model: https://github.com/khiav223577/deep_pluck/pull/19)

It works fine If you pluck deeply into associations

user.deep_pluck(:id, posts: :name)

But it will raise ArgumentError if you pluck attributes only

user.deep_pluck(:id)

Though you can always rewrite it by as_json method

user.as_json(only: :id)

no 🐛should live