lib/lockbox/calculations.rb in lockbox-0.6.8 vs lib/lockbox/calculations.rb in lockbox-1.0.0
- old
+ new
@@ -1,10 +1,15 @@
module Lockbox
module Calculations
def pluck(*column_names)
return super unless model.respond_to?(:lockbox_attributes)
- lockbox_columns = column_names.map.with_index { |c, i| [model.lockbox_attributes[c.to_sym], i] }.select { |la, _i| la && !la[:migrating] }
+ lockbox_columns = column_names.map.with_index do |c, i|
+ next unless c.respond_to?(:to_sym)
+ [model.lockbox_attributes[c.to_sym], i]
+ end.select do |la, _i|
+ la && !la[:migrating]
+ end
return super unless lockbox_columns.any?
# replace column with ciphertext column
lockbox_columns.each do |la, i|