Module: Tenacity::OrmExt::Ripple
- Defined in:
- lib/tenacity/orm_ext/ripple.rb
Overview
Tenacity relationships on Ripple objects require no special properties defined on the object. Tenacity will define the properties that it needs to support the relationships. Take the following class for example:
class Car
include Ripple::Document
include Tenacity
t_has_many :wheels
t_has_one :dashboard
t_belongs_to :driver
end
t_belongs_to
The t_belongs_to association will define a property named after the association. The example above will create a property named :driver_id The t_belongs_to relationship will also create a bucket in Riak that acts as an index to find objects by their foreign key. The bucket will be named after the Ripple class and the name of the property used to store the foreign key. In the above example, the bucket will be named tenacity_car_driver_id.
t_has_one
The t_has_one association will not define any new properties on the object, since the associated object holds the foreign key.
t_has_many
The t_has_many association will define a property named after the association. The example above will create a property named :wheels_ids
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Class Method Summary collapse
-
.setup(model) ⇒ Object
:nodoc:.
Class Method Details
.setup(model) ⇒ Object
:nodoc:
39 40 41 42 43 44 45 46 47 |
# File 'lib/tenacity/orm_ext/ripple.rb', line 39 def self.setup(model) #:nodoc: require 'ripple' if model.included_modules.include?(::Ripple::Document) model.send :include, Ripple::InstanceMethods model.extend Ripple::ClassMethods end rescue LoadError # Ripple not available end |