Search code examples
ruby-on-railsbefore-filter

before_filter in application_controller in rails application


HI ,

I am very new to rails application .

I am trying to execute 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 ??


Solution

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