I am excersising RailsTutorial and do not understand why I cannot read user’s activation_digest although I defined attr_reader for it as such:
activation digest is generated in create_automation_digest method that is called during object creation because it is hooked as such:
When I create user in rails console, and save him, I am able to see activation_digest token in user’s inspect:
2.2.1 :008 > user
=> #<User id: 1, name: “John Doe”, email: “email@example.com”, created_at: “2016-07-19 08:11:05”, updated_at: “2016-07-19 08:11:05”, password_digest: “$2a$10$gx2kggc3uP/DJRnII0f9H.vfoxF34j80Odkn.8i5ECt…”, remember_digest: nil, admin: false, activation_digest: “$2a$10$Iy1ClXr6qqJBp8DdmxazkuccE6842kj5EieoRerR4mS…”, activated: false, activated_at: nil>
However, when I try to read activation_digest using accessor, I get nil:
2.2.1 :009 > user.activation_digest
Could someone explain why I cannot read the activation_digest?