开发者

before_filter in application_controller in rails application

开发者 https://www.devze.com 2023-01-28 10:30 出处:网络
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.

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

精彩评论

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