vendredi 14 juillet 2017

Rails console issue with attr_encrypted

I am using rails attr_encrypted gem for encrypting data before storing in database. It works fine on my application as it encrypts with the provided key and decrypts it using the same key via my application. But when I create a instance with my rails console, it does not encrypt with the key that is provided in the application ( uses some random key each time maybe) and hence I am not able to decrypt it when I see that instance in my application.

Below picture shows that if I create the user with the same name twice in console, each time the encrypted data is different. I am following the tutorial on this page enter image description here

When I try to access the page on my application, the user made by console are showing this errorenter image description here

Aucun commentaire:

Enregistrer un commentaire