I am encountering a function (?) that I do not fully understand in Rails and ActiveRecord.
I am building a basic website where the user (created with devise) can upload a document (the fields are: title and the attachment)
Therefore, when the users goes to www.website.com/documents/new he is present with a simple_form that asks him to write a title and attache a PDF.
Once confirmed, the document is saved in the database and linked to the user. Everything works fine.
My question is the following: when I run rails console and run Document.last.hash (or for any other stored document), I get back a numeric field back such as: 3130256425345013276
Can someone explain me what it is?
Is it a hash function (like SHA-256 algorithm) to secure the encryption in the database?
If yes, among all the hash functions, which is the one ActiveRecord is using?
Is it a hash function to secure the encryption in the database?
It is a hash function, but has nothing to do with encryption. It's used when you use objects as keys in hashes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With