Sha256: 779fa7478f7e8733ac8cdc120ad38b6a83ef0f37ee55510bf5880f148745d229
Contents?: true
Size: 875 Bytes
Versions: 2
Compression:
Stored size: 875 Bytes
Contents
module AssociationWithOperator def find(*args) results = super if results.kind_of? Array results.each{|r| r.operator = proxy_owner.operator} else results.operator = proxy_owner.operator if results end results end def method_missing(method, *args) results = super unless ActiveRecord::NamedScope::Scope === results if results.respond_to?(:operator=) results.operator= proxy_owner.operator elsif results.kind_of? Array results.each{|r| r.operator = proxy_owner.operator if r.respond_to?(:operator=)} end end results end def construct_join_attributes(associate) join_attributes = super if @owner.operator || associate.operator join_attributes[:operator] ||= @owner.operator join_attributes[:operator] ||= associate.operator end join_attributes end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
nay-record_with_operator-0.0.20 | lib/association_with_operator.rb |
record_with_operator-0.0.22 | lib/association_with_operator.rb |