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



51
52
53
54
55
56
57
# File 'lib/sequel/plugins/dataset_associations.rb', line 51

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