Create a #many_through_many association. Arguments:
Same as associate, the name of the association.
The tables and keys to join between the current table and the associated table. Must be an array, with elements that are either 3 element arrays, or hashes with keys :table, :left, and :right. The required entries in the array/hash are:
The name of the table to join.
The key joining the table to the previous table. Can use an array of symbols for a composite key association.
The key joining the table to the next table. Can use an array of symbols for a composite key association.
If a hash is provided, the following keys are respected when using eager_graph:
A proc to use as the block argument to join.
Extra conditions to add to the JOIN ON clause. Must be a hash or array of two pairs.
The join type to use for the join, defaults to :left_outer.
Conditions to use for the join instead of the ones specified by the keys.
The options for the associaion. Takes the same options as many_to_many.
# File lib/sequel/plugins/many_through_many.rb, line 216 def many_through_many(name, through, opts=OPTS, &block) associate(:many_through_many, name, opts.merge(through.is_a?(Hash) ? through : {:through=>through}), &block) end
Creates a #one_through_many association. See #many_through_many for arguments.
# File lib/sequel/plugins/many_through_many.rb, line 221 def one_through_many(name, through, opts=OPTS, &block) associate(:one_through_many, name, opts.merge(through.is_a?(Hash) ? through : {:through=>through}), &block) end