Sha256: 885888ed7a1ca01442ea4d1b50633af5a7ccc4dd854a878e429fd54ced55d25d
Contents?: true
Size: 655 Bytes
Versions: 2
Compression:
Stored size: 655 Bytes
Contents
require 'active_record' require 'active_support' module Enygma module Adapters class ActiveRecordAdapter < Enygma::Adapters::AbstractAdapter def connect!(datastore) unless datastore.is_a?(Class) && datastore.ancestors.include?(ActiveRecord::Base) raise InvalidDatabase, "#{datastore.inspect} is not an ActiveRecord::Base subclass!" end @datastore = datastore end def query(args = {}) @datastore.scoped(:conditions => { :id => args[:ids] }) end def get_attribute(record, attribute) record.read_attribute(attribute) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sander6-enygma-0.1.0 | lib/enygma/adapters/active_record.rb |
sander6-enygma-0.1.1 | lib/enygma/adapters/active_record.rb |