

Learn HN: Roll Your Own Authentication in Rails 4 - thebiglebrewski
http://nycda.com/blog/basic-user-authentication-model-in-rails-4/

======
unfunco
You 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/SecurePasswor...](http://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html#method-
i-has_secure_password)

~~~
thebiglebrewski
I 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!

