Sha256: 78e4b95aceb7bf3705a4cdaff9e880d5707ef983503c2ae2cf0ebba1084247a5
Contents?: true
Size: 914 Bytes
Versions: 5
Compression:
Stored size: 914 Bytes
Contents
require 'active_support/concern' module Ardm module Ar module Repository extend ActiveSupport::Concern def repository(name=nil, &block) self.class.repository(name, &block) end module ClassMethods def repository(name=nil, &block) if name && name != :default raise Ardm::NotImplemented, "Alternate repository names not supported" end if block_given? yield else Ardm::Ar::Repository::Proxy.new self end end end class Proxy def initialize(model) @model = model end def adapter self end def select(*args) array_of_hashes = @model.connection.select_all(@model.send(:sanitize_sql_array, args)) array_of_hashes.map { |h| Hashie::Mash.new(h) } end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems