Created
August 22, 2013 20:13
-
-
Save r38y/6312196 to your computer and use it in GitHub Desktop.
Controller concern for dealing with some range errors from misbehaving visitors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rangy | |
extend ActiveSupport::Concern | |
included do | |
rescue_from ActiveRecord::StatementInvalid, RangeError, ArgumentError do |exception| | |
if exception.message =~ /is out of range for type integer|invalid offset|invalid value for Integer/ | |
render text: 'Not found', status: :not_found | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment