Sha256: aa5213ad8469fbe44b7e03939977f60d8e551f60c41519a68a69861d5fe16f1f
Contents?: true
Size: 808 Bytes
Versions: 4
Compression:
Stored size: 808 Bytes
Contents
module Ki class Model # the query interface does not respect before/after filters, # unique attributes, required attributes or anything of the # sort. # it writes directly to the database module QueryInterface def count hash={} Orm::Db.instance.count class_name, hash end def find hash={} Orm::Db.instance.find class_name, hash end def create hash Orm::Db.instance.insert class_name, hash end def find_or_create hash r = find hash r.empty? ? create(hash) : r end def update hash Orm::Db.instance.update class_name, hash end def delete hash Orm::Db.instance.delete class_name, hash end def class_name self.to_s end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ki-0.4.6 | lib/ki/modules/query_interface.rb |
ki-0.4.5 | lib/ki/modules/query_interface.rb |
ki-0.4.4 | lib/ki/modules/query_interface.rb |
ki-0.4.3 | lib/ki/modules/query_interface.rb |