Module: Sequel::Plugins::AssociationProxies::ClassMethods
- Defined in:
- lib/sequel/plugins/association_proxies.rb
Instance Attribute Summary collapse
-
#association_proxy_to_dataset ⇒ Object
readonly
Proc that accepts a method name, array of arguments, and block and should return a truthy value to send the method to the dataset instead of the array of associated objects.
Instance Method Summary collapse
-
#def_association_method(opts) ⇒ Object
Changes the association method to return a proxy instead of the associated objects directly.
Instance Attribute Details
#association_proxy_to_dataset ⇒ Object (readonly)
Proc that accepts a method name, array of arguments, and block and should return a truthy value to send the method to the dataset instead of the array of associated objects.
107 108 109 |
# File 'lib/sequel/plugins/association_proxies.rb', line 107 def association_proxy_to_dataset @association_proxy_to_dataset end |
Instance Method Details
#def_association_method(opts) ⇒ Object
Changes the association method to return a proxy instead of the associated objects directly.
113 114 115 116 117 118 119 120 121 |
# File 'lib/sequel/plugins/association_proxies.rb', line 113 def def_association_method(opts) if opts.returns_array? association_module_def(opts.association_method, opts) do |dynamic_opts=OPTS, &block| AssociationProxy.new(self, opts, dynamic_opts, &block) end else super end end |