Sha256: 3676561c07ea1a4c4beeff388efa02a9a2df20d090c73e50a7cac1345dd00345
Contents?: true
Size: 603 Bytes
Versions: 15
Compression:
Stored size: 603 Bytes
Contents
require "orm_adapter" class BazaModels::BazaOrmAdapter < ::OrmAdapter::Base def initialize(args) @klass = args.fetch(:class) end def column_names klass.column_names end def get!(id) klass.find(wrap_key(id)) end def get(id) klass.where(id: wrap_key(id)).first end def find_first(options) klass.find_first(options) end def find_all(options = {}) klass.where(options) end def create!(attributes = {}) klass.create!(attributes) end def destroy(object) if valid_object?(object) object.destroy else false end end end
Version data entries
15 entries across 15 versions & 1 rubygems