Sha256: 497d5979e0afbd0b37b9150f251feda255fadfe84e595e30bcb993b24be9c5df
Contents?: true
Size: 816 Bytes
Versions: 3
Compression:
Stored size: 816 Bytes
Contents
require 'ripple/associations/proxy' require 'ripple/validations/associated_validator' module Ripple module Associations module Embedded def initialize(*args) super lazy_load_validates_associated end protected def lazy_load_validates_associated return if @owner.class.validators_on(@reflection.name).any? {|v| Ripple::Validations::AssociatedValidator === v} @owner.class.validates @reflection.name, :associated => true end def assign_references(docs) Array.wrap(docs).each do |doc| next unless doc.respond_to?(:_parent_document=) doc._parent_document = owner end end def instantiate_target(*args) doc = super assign_references(doc) doc end end end end
Version data entries
3 entries across 3 versions & 3 rubygems
Version | Path |
---|---|
wyngle-ripple-0.1.0 | lib/ripple/associations/embedded.rb |
better-ripple-1.0.0 | lib/ripple/associations/embedded.rb |
ripple-1.0.0.beta2 | lib/ripple/associations/embedded.rb |