I'm writing an after_filter in Rails 3, and I'd like to detect whether or not the controller (or any other filter) has issued a redirect. Is there any way to do this?
You could look at the status
code. 200 is a render, 302 is a redirect.
after_filter :what_happened
protected
def what_happened
was_redirect = self.status == 302
was_render = self.status == 200
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With