首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

9.3 sign in success

2012-10-08 
9.3 sign in success.1. we will first finish the create action:??3. in this section, we will need so

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 : nil

this 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

热点排行