module Sequel::Plugins::DatasetAssociations::ClassMethods

  1. lib/sequel/plugins/dataset_associations.rb

Methods

Public Instance

  1. associate

Public Instance methods

associate(type, name, *)

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

[show source]
   # File lib/sequel/plugins/dataset_associations.rb
61 def associate(type, name, *)
62   ret = super
63   r = association_reflection(name)
64   meth = r.returns_array? ? name : pluralize(name).to_sym
65   dataset_module do
66     define_method(meth){associated(name)}
67     alias_method(meth, meth)
68   end
69   ret
70 end