Module: ROM::Yesql::Relation::ClassInterface

Defined in:
lib/rom/yesql/relation/class_interface.rb

Overview

API:

  • public

Instance Method Summary collapse

Instance Method Details

#dataset(name = Undefined) ⇒ Symbol

Sets dataset name for the relation class

The class will be extended with queries registered under that name. By default dataset name is derived from the class name, which doesn't have to match the key under which its queries were registered

Parameters:

  • (defaults to: Undefined)

Returns:

API:

  • public



18
19
20
21
22
# File 'lib/rom/yesql/relation/class_interface.rb', line 18

def dataset(name = Undefined)
  name = relation_name.to_sym if name == Undefined
  define_query_methods(self, Relation.queries[name] || {})
  ->(*) { self }
end