Sha256: d8a877488ee2ad9f2b636cf1b8934c53d58d3bec6a64b51d05d692b5579a7958
Contents?: true
Size: 490 Bytes
Versions: 3
Compression:
Stored size: 490 Bytes
Contents
module Nazrin class DataAccessor class ActiveRecord < Nazrin::DataAccessor # load from activerecord def load_all(ids) records_table = {} @options.each do |k, v| @model = @model.send(k, v) end @model.where(id: ids).each do |record| records_table[record.id] = record end ids.map do |id| records_table.select { |k, _| k == id.to_i }[id.to_i] end.reject(&:nil?) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nazrin-2.4.0 | lib/nazrin/data_accessor/active_record.rb |
nazrin-2.3.0 | lib/nazrin/data_accessor/active_record.rb |
nazrin-2.2.0 | lib/nazrin/data_accessor/active_record.rb |