Method: Inbox::RestfulModelCollection#where

Defined in:
lib/restful_model_collection.rb

#where(filters) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/restful_model_collection.rb', line 47

def where(filters)
  collection = self.clone

  # deep copy the object, otherwise filter is shared among all
  # the instances of the collection, which leads to confusing behaviour.
  # - karim
  if collection.filters == nil
    collection.filters = {}
  else
    collection.filters = Marshal.load(Marshal.dump(collection.filters))
  end

  collection.filters.merge!(filters)
  collection
end