9.3 sign in success.
1. we will first finish the create action:
?
?
3. in this section, we will need some methods that are need to in both controller and view,?
for view, we can define the method in SessionHelpr, (the method in all helpers are viewable for all views.)
to make controller see this method, we just need to include this module into the controller.
?
?note,?
so?authenticate_with_salt in general should accept two arguments.(id, user_salt)
b. another thing is:def self.authenticate_with_salt(id, cookie_salt)user = find_by_id(id)(user && user.salt == cookie_salt) ? user : nilend?(user && user.salt == cookie_salt) ? user : nilthis is very traditional rails code, you really should get used to it!!!?
?
d. we still need to define the signed_in method.
?
def signed_in?
!current_user.nil?
end