Sha256: d437a2c9c0125b9266309a371bf1b27c39c9d299384d49803c68ce9538d75fec

Contents?: true

Size: 531 Bytes

Versions: 7

Compression:

Stored size: 531 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
    end
    results
  end


  def method_missing(method, *args)
    results = super
    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
    results
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nay-record_with_operator-0.0.2 lib/association_with_operator.rb
nay-record_with_operator-0.0.3 lib/association_with_operator.rb
nay-record_with_operator-0.0.4 lib/association_with_operator.rb
nay-record_with_operator-0.0.5 lib/association_with_operator.rb
nay-record_with_operator-0.0.6 lib/association_with_operator.rb
nay-record_with_operator-0.0.7 lib/association_with_operator.rb
nay-record_with_operator-0.0.8 lib/association_with_operator.rb