Sha256: 64d9c31499cd0936c4af574960150590660bb8211f9c7d9e40ec6a68b0fc33ba

Contents?: true

Size: 418 Bytes

Versions: 3

Compression:

Stored size: 418 Bytes

Contents

# -*- encoding : utf-8 -*-

require 'guacamole/proxies/proxy'

module Guacamole
  module Proxies
    # The {ReferencedBy} proxy is used to represent the 'one' in one-to-many relations.
    class ReferencedBy < Proxy
      def initialize(ref, model)
        init model,
             -> { DocumentModelMapper.collection_for(ref).by_example("#{model.class.name.underscore}_id" => model.key) }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
guacamole-0.3.0 lib/guacamole/proxies/referenced_by.rb
guacamole-0.2.0 lib/guacamole/proxies/referenced_by.rb
guacamole-0.1.0 lib/guacamole/proxies/referenced_by.rb