module ActionDispatch::Routing
  class Mapper

    def with_tenant
      scope constraints: Peephole::TenantSubdomainConstraint.new do
        yield if block_given?
      end
    end
    alias_method :for_tenant, :with_tenant

    def without_tenant
      scope constraints: Peephole::WithoutSubdomainConstraint.new do
        yield if block_given?
      end
    end

  end
end

module ActionDispatch::Routing
  class Mapper

    def with_tenant *args
      constraints = Peephole::TenantSubdomainConstraint.new *args
      scope constraints: constraints do
        yield if block_given?
      end
    end
    alias_method :for_tenant, :with_tenant

    def without_tenant *args
      constraints = Peephole::WithoutSubdomainConstraint.new *args
      scope constraints: constraints do
        yield if block_given?
      end
    end

  end
end

Add arguments to routing helpers
Add arguments to routing helpers
