Rails Quality Control Tip: Use Verify in Controllers

Have you found that any of your Rails projects get hits to controller methods that expect parameters? A neat way of handling this is the ActionController::Verification module.
By adding calls to verify in your controller, you can elegantly catch all kinds of unexpected but reasonable uses of your system: from mistyped URLs and browser history auto–complete to web crawlers blindly following links. This way, you can redirect people somewhere logical instead of flashing them with an error message.
You can even insert a message into the flash:
verify :params => "user",
:only => :update_password,
:add_flash => { "alert" => "Updating your password was not possible without the required information" },
:redirect_to => :config_url