ROM::Relation::ClassInterface#view

Parsed documentation:
View on GitHub
Define a relation view with a specific schema

Explicit relation views allow relation composition with auto-mapping
in repositories. It's useful for cases like defining custom views
for associations where relations (even from different databases) can
be composed together and automatically mapped in memory to structs.

@overload view(name, schema, &block)
  @example View with the canonical schema
    class Users < ROM::Relation[:sql]
      view(:listing, schema) do
        order(:name)
      end
    end

  @example View with a projected schema
    class Users < ROM::Relation[:sql]
      view(:listing, schema.project(:id, :name)) do
        order(:name)
      end
    end

@overload view(name, &block)
  @example View with the canonical schema and arguments
    class Users < ROM::Relation[:sql]
      view(:by_name) do |name|
        where(name: name)
      end
    end

  @example View with projected schema and arguments
    class Users < ROM::Relation[:sql]
      view(:by_name) do
        schema { project(:id, :name) }
        relation { |name| where(name: name) }
      end
    end

@return [Symbol] view method name

@api public
Suggestions:
Please help! Open an issue on GitHub if this assessment is incorrect.