Module: Sequel::Plugins::DatasetAssociations::ClassMethods

Defined in:
lib/sequel/plugins/dataset_associations.rb

Instance Method Summary collapse

Instance Method Details

#associate(type, name) ⇒ Object

Set up a dataset method for each association to return an associated dataset



61
62
63
64
65
66
67
# File 'lib/sequel/plugins/dataset_associations.rb', line 61

def associate(type, name, *)
  ret = super
  r = association_reflection(name)
  meth = r.returns_array? ? name : pluralize(name).to_sym
  def_dataset_method(meth){associated(name)}
  ret
end