OK, as is often the case, I have a controller action in my app that is protected from unauthorized access by a before_filter. The only thing is that I need to redirect this action if another condition is true:
class Payment < ApplicationController
before_filter login_required
def new
redirect_to some_other_path if @order.is_free?
@payment = Payment.new
end
end
In my testing, I check to make sure that the action is correctly protected, however, it is also the case that the @order.is_free statement is true. When this is the case, I get the following error:
`render_with_no_layout': Can only render or redirect once per action
Is there any way of checking to make sure I'm not already redirecting or to override an existing redirect?