Sha256: 1b2615415ea1004d63cff35b38505875c861c8f250ec0e2c0c487a9c09fb6493

Contents?: true

Size: 470 Bytes

Versions: 4

Compression:

Stored size: 470 Bytes

Contents

require 'ripple/associations/proxy'
require 'ripple/associations/one'
require 'ripple/associations/linked'

module Ripple
  module Associations
    class OneLinkedProxy < Proxy
      include One
      include Linked

      def key
        keys.first
      end

      protected
      def find_target
        return nil if links.blank?

        robjs = robjects
        return nil if robjs.blank?

        klass.send(:instantiate, robjs.first)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
wyngle-ripple-0.1.0 lib/ripple/associations/one_linked_proxy.rb
better-ripple-1.0.0 lib/ripple/associations/one_linked_proxy.rb
ripple-1.0.0.beta2 lib/ripple/associations/one_linked_proxy.rb
ripple-1.0.0.beta lib/ripple/associations/one_linked_proxy.rb