diff --git a/lib/active_force/active_query.rb b/lib/active_force/active_query.rb index cb54a7a..401da3a 100644 --- a/lib/active_force/active_query.rb +++ b/lib/active_force/active_query.rb @@ -78,9 +78,17 @@ def where args=nil, *rest super build_condition args, rest end - def select *selected_fields - selected_fields.map! { |field| mappings[field] } - super *selected_fields + def select *selected_fields, &block + if block + result = [] + self.each do |record| + result << record if block.call(record) + end + result + else + selected_fields.map! { |field| mappings[field] } + super *selected_fields + end end def ids