Module: Ripple::Associations
- Extended by:
- ActiveSupport::Concern
- Defined in:
- ripple/lib/ripple/associations.rb,
ripple/lib/ripple/associations/one.rb,
ripple/lib/ripple/associations/many.rb,
ripple/lib/ripple/associations/proxy.rb,
ripple/lib/ripple/associations/linked.rb,
ripple/lib/ripple/associations/embedded.rb,
ripple/lib/ripple/associations/instantiators.rb,
ripple/lib/ripple/associations/one_linked_proxy.rb,
ripple/lib/ripple/associations/many_linked_proxy.rb,
ripple/lib/ripple/associations/one_embedded_proxy.rb,
ripple/lib/ripple/associations/many_embedded_proxy.rb
Overview
Adds associations via links and embedding to Document models. Examples:
# Documents can contain embedded documents, and link to other standalone documents # via associations using the many and one class methods. class Person include Ripple::Document property :name, String many :addresses many :friends, :class_name => "Person" one :account end # Account and Address are embeddable documents class Account include Ripple::EmbeddedDocument property :paid_until, Time :person # Adds "person" method to get parent document end class Address include Ripple::EmbeddedDocument property :street, String property :city, String property :state, String property :zip, String end person = Person.find("adamhunter") person.friends << Person.find("seancribbs") # Links to people/seancribbs with tag "friend" person.addresses << Address.new(:street => "100 Main Street") # Adds an embedded address person.account.paid_until = 3.months.from_now
Defined Under Namespace
Modules: ClassMethods, Embedded, InstanceMethods, Instantiators, Linked, Many, One Classes: ManyEmbeddedProxy, ManyLinkedProxy, OneEmbeddedProxy, OneLinkedProxy, Proxy