Sha256: 0b85e472f5f6f30b8f63eaf75b53cc74fc9492da565c4ae1d52f988411db701a
Contents?: true
Size: 1.01 KB
Versions: 7
Compression:
Stored size: 1.01 KB
Contents
require 'active_repository/adapters/default_adapter' class MongoidAdapter < DefaultAdapter class << self # def all(klass) # klass.all # end # def delete_all(klass) # klass.delete_all # end def exists?(klass, id) klass.get_model_class.where(:id => id).present? end # def find(klass, id) # klass.find(id) # end # def first(klass) # klass.first # end # def last(klass) # klass.last # end # def create(klass, attributes) # klass.create(attributes) # end # def update_attribute(klass, id, key, value) # object = id.nil? ? klass.new(key.to_sym => value) : klass.find(id) # ret = object.update_attribute(key, value) # [ret, object] # end # def update_attributes(klass, id, attributes) # object = id.nil? ? klass.new : klass.find(id) # ret = object.update_attributes(attributes) # [ret, object] # end # def where(klass, args) # klass.where(args) # end end end
Version data entries
7 entries across 7 versions & 1 rubygems