Sha256: 551d8fb81a83bb4ea9aefb66e38e869b78f257bdf4fa05e995bffa588a7c1ece
Contents?: true
Size: 873 Bytes
Versions: 2
Compression:
Stored size: 873 Bytes
Contents
module Voltron class Encrypt module ActiveRecord module CollectionAssociation def ids_writer(ids) if klass.has_encrypted_id? ids.reject!(&:blank?) replace(klass.find(ids)) else super ids end end def ids_reader if loaded? load_target.map do |record| if klass.has_encrypted_id? record.to_param else record.send(reflection.association_primary_key) end end else if klass.has_encrypted_id? scope.map(&:to_param) else column = "#{reflection.quoted_table_name}.#{reflection.association_primary_key}" scope.pluck(column) end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
voltron-encrypt-0.1.4 | lib/voltron/encrypt/active_record/collection_association.rb |
voltron-encrypt-0.1.5 | lib/voltron/encrypt/active_record/collection_association.rb |