I have a filter_before filter that checks to see if a param is true. If it is my app does this. However, the && return seems to be causing some problems. When I take it out, it’ll redirect form every page to the desired countdown page–but then it loops or double renders.
redirect_to :countdown && return if @online == 1
Is there a way to wrap this in an if statement?
Something like:
if current_page(:countdown)
redirect_to :countdown if @online == 1
end
You’d better exclude the
countdownaction from yourbefore_filterto avoid infinite loop.something like:
That said, what you did is valid: