spec/fixtures/poro.rb
# TODO: the integer casting here should go away with attribute types
the integer casting here should go away with attribute types
the integer casting here should go away with attribute types
def apply_filtering(records, params)
        return records unless params[:conditions]
        records.select! do |record|
          params[:conditions].all? do |key, value|
            db_value = record.send(key) if record.respond_to?(key)
            if key == :id
              value = value.is_a?(Array) ? value.map(&:to_i) : value.to_i
            end
            if value.is_a?(Array)
              value.include?(db_value)
            else
              db_value == value
            end
          end
        end
        records
      end
def apply_filtering ( records , params ) return records unless params [ :conditions ] records . select! do | record | params [ :conditions ] . all? do | key , value | db_value = record . send ( key ) if record . respond_to? ( key ) if key == :id value = value . is_a? ( Array ) ? value . map ( & :to_i ) : value . to_i end if value . is_a? ( Array ) value . include? ( db_value ) else db_value == value end end end records end
TODO: the integer casting here should go away with attribute types
TODO : the integer casting here should go away with attribute types
records
params