Method: ROM::Relation::ClassInterface#forward

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

#forward(*methods) ⇒ Object

Dynamically define a method that will forward to the dataset and wrap response in the relation itself

Examples:

class SomeAdapterRelation < ROM::Relation
  forward :super_query
end


232
233
234
235
236
237
238
239
240
# File 'lib/rom/relation/class_interface.rb', line 232

def forward(*methods)
  methods.each do |method|
    class_eval <<-RUBY, __FILE__, __LINE__ + 1
      def #{method}(*args, &block)
        new(dataset.__send__(:#{method}, *args, &block))
      end
    RUBY
  end
end