I am trying to populate column_name with items from @enc. Problem is #update_all updates all fields with last item in array?
Last item is "MPq3KSzDzLvTeYh+h00HD+5FAgKoNksykJhzROVZWbIJ36WNoBgkSoicJ5wx\nog0g\n".
I am trying to populate with all items from array not just last. I hope question is clear? I tried #update_attributes, but no success? Help. Thanks
@enc=["hUt7ocoih//kFpgEizBowBAdxqqbGV1jkKVipVJwJnPGoPtTN16ZAJvW9tsi\n3inn\n", "wGNyaoEZ09jSg+/IclWFGAXzwz5lXLxJTUKqCFIiOy3ZXRgdwFUsNf/75R2V\nZm83\n", "MPq3KSzDzLvTeYh+h00HD+5FAgKoNksykJhzROVZWbIJ36WNoBgkSoicJ5wx\nog0g\n"]
@enc.each do |i|
PaymentMethod.update_all(enc_number: i)
end
Model
andcolumn_name
with your actual model and column names? – Stefan Jul 25 '14 at 9:31Model
andcolumn_name
isn't the actual column's name – Stefan Jul 25 '14 at 9:34