trabajo-afectivo/app/models/store/provider/db.rb

29 lines
588 B
Ruby
Raw Normal View History

# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
2015-04-27 21:44:41 +00:00
class Store
2015-04-27 22:02:11 +00:00
module Provider
2015-04-27 21:44:41 +00:00
class DB < ApplicationModel
self.table_name = 'store_provider_dbs'
2015-04-27 21:44:41 +00:00
def self.add(data, sha)
Store::Provider::DB.create(
data: data,
sha: sha,
)
true
end
2015-04-27 21:44:41 +00:00
def self.get(sha)
file = Store::Provider::DB.where( sha: sha ).first
return if !file
file.data
end
2015-04-27 21:44:41 +00:00
def self.delete(sha)
Store::Provider::DB.where( sha: sha ).destroy_all
true
end
end
end
end