def render_bad_parameters(*args)
      default_message = if request.xhr?
                          _('Invalid parameters sent in the request for this operation. Please contact a system administrator.')
                        else
                          _('Invalid parameters sent. You may have mistyped the address. If you continue having trouble with this, please contact an Administrator.')
                        end

      exception = args.find { |o| o.is_a? Exception }
      message   = args.find { |o| o.is_a? String } || exception.try(:message) || default_message

      status = if exception && exception.respond_to?(:status_code)
                 exception.status_code
               else
                 400
               end

      if exception
        log_exception exception
      else
        Rails.logger.warn message
      end

      respond_to do |format|
        format.html do
          render :template => 'common/400', :layout => !request.xhr?, :status => status,
                 :locals   => {:message => message}
        end
        format.atom { head exception.status_code }
        format.xml  { head exception.status_code }
        format.json { head exception.status_code }
      end
      User.current = nil
    end
def render_bad_parameters(*args)
      default_message = if request.xhr?
                          _('Invalid parameters sent in the request for this operation. Please contact a system administrator.')
                        else
                          _('Invalid parameters sent. You may have mistyped the address. If you continue having trouble with this, please contact an Administrator.')
                        end

      exception = args.find { |o| o.is_a? Exception }
      message   = args.find { |o| o.is_a? String } || exception.try(:message) || default_message

      status = if exception && exception.respond_to?(:status_code)
                 exception.status_code
               else
                 400
               end

      if exception
        log_exception exception
      else
        Rails.logger.warn message
      end

      respond_to do |format|
        format.html do
          render :template => 'common/400', :layout => !request.xhr?, :status => status,
                 :locals   => {:message => message}
        end
        format.atom { head exception.status_code }
        format.xml  { head exception.status_code }
        format.json { head exception.status_code }
      end
      User.current = nil
    end
render bad params to user
 @overload render_bad_parameters()
   render bad_parameters with `default_message` and status `400`
 @overload render_bad_parameters(message)
   render bad_parameters with `message` and status `400`
   @param [String] message
 @overload render_bad_parameters(error)
   render bad_parameters with `error.message` and `error.status_code` if present
   @param [Exception] error
 @overload render_bad_parameters(error, message)
   add `message` to overload `exception.message`
   @param [String] message
   @param [Exception] error