Skip to content

Instantly share code, notes, and snippets.

@purplejacket
Created February 11, 2011 23:17
Show Gist options
  • Save purplejacket/823254 to your computer and use it in GitHub Desktop.
Save purplejacket/823254 to your computer and use it in GitHub Desktop.
attempt at returning a 500 error if the params hash has a nil value
# Is this the proper way to detect whether any of the params has a nil value?
# I think it's being superseded by the before_filter because I see
# /Users/kaimiddleton/Sites/thundercat/vendor/plugins/fixie_whitelister/lib/white_list_helper.rb:34:in `strip_naughty_stuff'
# when I hit the browser with, say, http://localhost:3000/?/
class MainController < ApplicationController
skip_before_filter :require_restrictive_access
before_filter :main_sidebar, :only => [:index, :landing_page]
def index
if params.has_value? nil
render :status => 500
return
end
# ...
end
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment