Method: ROM::SQL::Relation#assoc

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

#assoc(name) ⇒ Relation

Return relation that will load associated tuples of this relation

This method is useful for defining custom relation views for relation composition when you want to enhance default association query

Examples:

assoc(:tasks).where(tasks[:title] => "Task One")

Parameters:

  • name (Symbol)

    The association name

Returns:



115
116
117
# File 'lib/rom/sql/relation.rb', line 115

def assoc(name)
  associations[name].()
end