Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
- Defined in:
- lib/deep_pluck.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.deep_pluck(*args) ⇒ Object
13 14 15 |
# File 'lib/deep_pluck.rb', line 13 def self.deep_pluck(*args) where('').deep_pluck(*args) end |
Instance Method Details
#deep_pluck(*args) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/deep_pluck.rb', line 17 def deep_pluck(*args) hash_args, other_args = args.partition{|s| s.is_a?(Hash) } model = DeepPluck::Model.new(self, need_columns: other_args) model.add(*hash_args) if hash_args.any? return model.load_all.first end |