module Tenacity::OrmExt::Toystore

Tenacity relationships on Toystore objects require no special attributes defined on the object. Tenacity will define the attributes that it needs to support the relationships. Take the following class for example:

class Car
  include Toy::Store
  store :mongo, Mongo::Connection.new.db('tenacity')['toystore']
  include Tenacity

  t_has_many    :wheels
  t_has_one     :dashboard
  t_belongs_to  :driver
end

Please note that the data store must be established before including the Tenacity module.

t_belongs_to

The t_belongs_to association will define an attribute named after the association. The example above will create an attribute named :driver_id

t_has_one

The t_has_one association will not define any new attributes on the object, since the associated object holds the foreign key.

t_has_many

The t_has_many association will define an attribute named after the association. The example above will create attribute named :wheels_ids