We build Web & Mobile Applications.
Here’s one that could have you scratching your head in puzzlement for a little while. In Rails 1.2.x you could do something like this in your controller:
class PostsController < ActionController::Base
before_filter :do_filter
# Controller code
protected
def do_filter
# Filter logic goes here
# Halt the filter chain
false
end
end
If the filter returned false then processing of the request would stop and you’d see a blank page in your browser.
Not so in Rails 2.0: thanks to changeset 7984 the filter chain is only halted if you render or redirect within your filter. If you really want to get similar behaviour to Rails 1.2.x you could always do this:
def do_filter
# Filter logic goes here
# Halt the filter chain
head :bad_request
end
Although you will probably be more popular with your users if you display some kind of friendly error message!