class Matching::ActiveRelationStore
Stores and retrieves data from ActiveRelation for Matcher
Attributes
model[R]
where_clause[R]
Public Class Methods
new(model, where_clause = nil)
click to toggle source
# File lib/matching/active_relation_store.rb, line 10 def initialize(model, where_clause = nil) @model = model @where_clause = where_clause end
Public Instance Methods
each(&blk)
click to toggle source
Iterates over array, also returning id
# File lib/matching/active_relation_store.rb, line 16 def each(&blk) @model.where(@where_clause).find_in_batches do |group| group.each do |obj| blk.yield(obj, obj.id) end end end
find(id)
click to toggle source
Return an object by its AR id
# File lib/matching/active_relation_store.rb, line 25 def find(id) @model.find(id) end