07-19-2023, 01:15 AM
I'm doing the [Rails tutorial by Michael Hartl][1], and I've come to the point where you simply add:
has_secure_password
to your model class and a bunch of magic happens.
I understand that this method comes from the `ActiveModel::SecurePassword` module that is included in `ActiveRecord::Base`, which my model class extends.
What I don't understand is what is going on when I add that one line to my class definition. Can somebody please explain, in as much detail as possible. I really want to understand what is going on and not just throw stuff at my app not knowing how it works.
(If it helps to understand why I'm confused, I come from a Java background and I'm new to Ruby)
[1]:
has_secure_password
to your model class and a bunch of magic happens.
I understand that this method comes from the `ActiveModel::SecurePassword` module that is included in `ActiveRecord::Base`, which my model class extends.
What I don't understand is what is going on when I add that one line to my class definition. Can somebody please explain, in as much detail as possible. I really want to understand what is going on and not just throw stuff at my app not knowing how it works.
(If it helps to understand why I'm confused, I come from a Java background and I'm new to Ruby)
[1]:
[To see links please register here]