开发者

before_filter in application_controller in rails application

HI ,

I am very new to rails application .

I am trying to exec开发者_JAVA技巧ute a method as long as the logged in user is alive. For that i have added a method on before_filter of application_controller

ANd my code is

before_filter :update_user

def update_user
   @user=current_user
   @user.update_attributes(:last_active=> Time.current)
   render :layout => false
end

But the above showing me some error.. How to resolve this ??


You should remove the render :layout => false line in the method. Otherwise it will not continue to the actual action that was routed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜