In the :with => record_not_found
argument to rescue_from
, record_not_found
has not been defined yet, so it's raising the error. You should be providing a symbol instead, as in:
rescue_from ActiveRecord::RecordNotFound, :with => :record_not_found
in keeping with the example in http://api.rubyonrails.org/classes/ActiveSupport/Rescuable/ClassMethods.html#method-i-rescue_from