# A bunch of validations for incoming webhooks to ensure github is sending them
module WebhookValidations
  extend ActiveSupport::Concern

  def verify_incoming_webhook_address!
    if valid_incoming_webhook_address?
      true
    else
      render :status => 404, :json => "{}"
    end
  end

  def valid_incoming_webhook_address?
    if Octokit.api_endpoint == "https://api.github.com/"
      GithubSourceValidator.new(request.ip).valid?
    else
      true
    end
  end
end

# A bunch of validations for incoming webhooks to ensure github is sending them
module WebhookValidations
  extend ActiveSupport::Concern

  def verify_incoming_webhook_address!
    if valid_incoming_webhook_address?
      true
    else
      render :json => {}, :status => :not_found
    end
  end

  def valid_incoming_webhook_address?
    if Octokit.api_endpoint == "https://api.github.com/"
      GithubSourceValidator.new(request.ip).valid?
    else
      true
    end
  end
end

Use :not_found instead of 404
Use :not_found instead of 404
