Method: MapPLZ::GeoItem#delete_item

Defined in:
lib/mapplz.rb

#delete_itemObject



749
750
751
752
753
754
755
756
757
758
759
760
761
762
# File 'lib/mapplz.rb', line 749

def delete_item
  if @db_type == 'array'
    keys.each do |key|
      delete(key)
    end
  elsif @db_type == 'mongodb'
    # update record in database
    @db[:client].remove(_id: BSON::ObjectId(self[:_id]))
  elsif @db_type == 'postgis'
    @db_client.exec("DELETE FROM mapplz WHERE id = #{self[:id]}")
  elsif @db_type == 'spatialite'
    @db_client.execute("DELETE FROM mapplz WHERE id = #{self[:id]}")
  end
end