Module: Tire::Model::Persistence::Storage::ClassMethods

Defined in:
lib/tire/model/persistence/storage.rb

Instance Method Summary collapse

Instance Method Details

#create(args = {}) ⇒ Object


17
18
19
20
21
22
23
24
25
# File 'lib/tire/model/persistence/storage.rb', line 17

def create(args={})
  document    = new(args)
  return false unless document.valid?
  if result = document.save
    document
  else
    result
  end
end

#delete(&block) ⇒ Object


27
28
29
# File 'lib/tire/model/persistence/storage.rb', line 27

def delete(&block)
  DeleteByQuery.new(index_name, {:type => document_type}, &block).perform
end