Ruby on Rails
Tuesday, July 19, 2016
Hi,
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:
attr_reader :activation_digest
activation digest is generated in create_automation_digest method that is called during object creation because it is hooked as such:
before_create :create_activation_digest
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: "johndoe@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
=> nil
Could someone explain why I cannot read the activation_digest?
Thanks
Vaclav
-- 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:
attr_reader :activation_digest
activation digest is generated in create_automation_digest method that is called during object creation because it is hooked as such:
before_create :create_activation_digest
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: "johndoe@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
=> nil
Could someone explain why I cannot read the activation_digest?
Thanks
Vaclav
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/eb73b6a2-f0f8-4055-881d-ccbdec3391a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment