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
19 20 21 |
# File 'lib/deep_pluck.rb', line 19 def self.deep_pluck(*args) where('').deep_pluck(*args) end |
.ta_pluck(*attribute_names) ⇒ Object
30 31 32 33 |
# File 'lib/deep_pluck.rb', line 30 def self.ta_pluck(*attribute_names) args = DeepPluck::Config.attribute_names_to_args(attribute_names) deep_pluck(*args) end |
Instance Method Details
#deep_pluck(*args) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/deep_pluck.rb', line 23 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 |
#ta_pluck(*attribute_names) ⇒ Object
35 36 37 38 |
# File 'lib/deep_pluck.rb', line 35 def ta_pluck(*attribute_names) args = DeepPluck::Config.attribute_names_to_args(attribute_names) deep_pluck(*args) end |