Sha256: 1390bd876360654e1a1de25e65048388bc1756829c2c76f06985fcbc10502aaa
Contents?: true
Size: 575 Bytes
Versions: 2
Compression:
Stored size: 575 Bytes
Contents
require 'active_support/concern' require 'active_support/core_ext/string/filters' module ActiveHouse module Collectable extend ActiveSupport::Concern def initialize(*) @collection = nil super end def to_a collection end def reset @collection = nil end def loaded? !@collection.nil? end def collection @collection ||= fetch_collection end def fetch_collection result = connection.select_rows(to_query.squish) result.map { |row| model_class.load!(row) } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_house-0.2.0 | lib/active_house/collectable.rb |
active_house-0.1.5 | lib/active_house/collectable.rb |