lib/rom/sql/plugin/associates.rb in rom-sql-2.0.0.beta3 vs lib/rom/sql/plugin/associates.rb in rom-sql-2.0.0.rc1
- old
+ new
@@ -8,10 +8,11 @@
# @api private
module Associates
class AssociateOptions
attr_reader :name, :assoc, :opts
+ # @api private
def initialize(name, relation, opts)
@name = name
@assoc = relation.associations[name]
@opts = { assoc: assoc, keys: assoc.join_keys }
@opts.update(parent: opts[:parent]) if opts[:parent]
@@ -40,10 +41,11 @@
option :configured_associations, default: -> { EMPTY_ARRAY }
end
super
end
+ # @api public
module ClassMethods
# @see ROM::Command::ClassInterface.build
#
# @api public
def build(relation, options = EMPTY_HASH)
@@ -132,9 +134,15 @@
end
result_type == :one ? output_tuples[0] : output_tuples
end
+ # Return a new command with the provided association
+ #
+ # @param [Symbol, Relation::Name] name The name of the association
+ #
+ # @return [Command]
+ #
# @api public
def with_association(name, opts = EMPTY_HASH)
self.class.build(
relation,
**options,