4 ms·
Learn HN: Roll Your Own Authentication in Rails 4
- unfunco 13y agoYou have made this more complicated than it needs to be. You realise that most of what you're telling people to do is already done? Rename password_hash to password_digest and read into has_secure_password[0], that way you will not have to write your own authenticate and encrypt_password methods. [0]: http://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html#method-i-has_secure_password http://api.rubyonrails.org/classes/ActiveModel/SecurePasswor...
- thebiglebrewski 13y agoI think you misunderstood the point of the article. I wanted to illustrate how these methods work underneath the hood so that students understand that instead of using more Rails magic to obfuscate what's really happening. I also mention that at the beginning of the article as a viable option along with Devise. Thanks for your feedback!