Module: Sequel::Plugins::DatasetAssociations::ClassMethods
- Defined in:
- lib/sequel/plugins/dataset_associations.rb
Instance Method Summary collapse
-
#associate(type, name) ⇒ Object
Set up a dataset method for each association to return an associated dataset.
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 68 69 70 |
# 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 dataset_module do define_method(meth){associated(name)} alias_method(meth, meth) end ret end |