Hi guys,
I have the app based only on ajax calls but i need constantly to check the decreasing value in session variable. I created a before_filter with a redirect_to :action => :action_name
for some reason this doesn"t work for me. I see in log Filter chain halted as [:method_name] rendered_or_redirected.
but in fact nothing happens.
Does anyone know what's the problem? I wanted to make the code DRY with using filters but looks like it's not handling ajax requests :(
The code is pretty simple (it's a game actually) here's the method which hangs on before_filter
def check_winner
if session[:game].user.cards.length == 0 || session[:game].pc.cards.length == 0
flash[:notice] = "The end"
redirect_to :action => "win"
end
end
session[:game] keeps several objects that I initialize at the beginning of the game. I've never used rails filters with ajax but it worked always with normal http requests
The user triggers actions everywhere via link_to_remote
I tryed to render ajax page update on the filter method but it just throws me doble render error :(