User.first.name # => "Renan"
User.first.name # => OpenSSL::Cipher::CipherError: bad decrypt
The error above is because the value of column name
into dabase already exists and has the value renan
, so who could I fix this :x
You'll need to update all records:
User.find_each do |user|
user.name = user.attributes['name']
user.save!
end
As a result all users will get new encrypted values.