Sha256: 3efad3074417a86602b8efece992babc87cf9a212a1688f85e3220439a83583b
Contents?: true
Size: 532 Bytes
Versions: 5
Compression:
Stored size: 532 Bytes
Contents
require "pluck_map/attribute" module PluckMap module Relationships class One < Base protected def build_select Arel.sql("(#{scope.select(attributes.to_json_array).to_sql})") end def build_map lambda do |values| return nil if values.nil? values = JSON.parse(values) if values.is_a?(String) attributes.each_with_object({}) do |attribute, hash| hash[attribute.name] = attribute.exec(values) end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems