def t_has_one(name, options={})
      extend(Associations::HasOne::ClassMethods)
      association = _t_create_association(:t_has_one, name, options)
      initialize_has_one_association(association)

      define_method(association.name) do |*params|
        get_associate(association, params) do
          has_one_associate(association)
        end
      end

      define_method("#{association.name}=") do |associate|
        set_associate(association, associate) do
          set_has_one_associate(association, associate)
        end
      end
    end
def t_has_one(name, options={})
      extend(Associations::HasOne::ClassMethods)
      association = _t_create_association(:t_has_one, name, options)
      initialize_has_one_association(association)

      define_method(association.name) do |*params|
        get_associate(association, params) do
          has_one_associate(association)
        end
      end

      define_method("#{association.name}=") do |associate|
        set_associate(association, associate) do
          set_has_one_associate(association, associate)
        end
      end
    end
Specifies a one-to-one association with another class. This method should only be used
 if the other class contains the foreign key. If the current class contains the foreign key,
 then you should use +t_belongs_to+ instead.

 The following methods for retrieval and query of a single associated object will be added:

 [association(force_reload = false)]
   Returns the associated object. +nil+ is returned if none is found.
 [association=(associate)]
   Assigns the associate object, extracts the primary key, sets it as the foreign key,
   and saves the associate object.

 (+association+ is replaced with the symbol passed as the first argument, so
 <tt>t_has_one :manager</tt> would add among others <tt>manager.nil?</tt>.)

 === Example

 An Account class declares <tt>t_has_one :beneficiary</tt>, which will add:
 * <tt>Account#beneficiary</tt> (similar to <tt>Beneficiary.find(:first, :conditions => "account_id = #{id}")</tt>)
 * <tt>Account#beneficiary=(beneficiary)</tt> (similar to <tt>beneficiary.account_id = account.id; beneficiary.save</tt>)

 === Supported options
 [:class_name]
   Specify the class name of the association. Use it only if that name can't be inferred
   from the association name. So <tt>t_has_one :manager</tt> will by default be linked to the Manager class, but
   if the real class name is Person, you'll have to specify it with this option.
 [:foreign_key]
   Specify the foreign key used for the association. By default this is guessed to be the name
   of this class in lower-case and "_id" suffixed. So a Person class that makes a +t_has_one+ association
   will use "person_id" as the default <tt>:foreign_key</tt>.
 [:dependent]
   If set to <tt>:destroy</tt>, the associated object is deleted when this object is, and all delete
   callbacks are called.  If set to <tt>:delete</tt>, the associated object is deleted *without*
   calling any of its delete callbacks.  If set to <tt>:nullify</tt>, the associated object's
   foreign key is set to +NULL+.
 [:readonly]
   If true, the associated object is readonly through the association.
 [:autosave]
   If true, always save the associated object or destroy it if marked for destruction, when saving the parent object. Off by default.
 [:as]
   Specifies a polymorphic interface (See <tt>t_belongs_to</tt>).
 [:disable_foreign_key_constraints]
   If true, bypass foreign key constraints, like verifying no other objects are storing the key of the source object
   before deleting it.  Defaults to false.

 Option examples:
   t_has_one :credit_card, :dependent => :destroy  # destroys the associated credit card
   t_has_one :credit_card, :dependent => :nullify  # updates the associated records foreign key value to NULL rather than destroying it
   t_has_one :project_manager, :class_name => "Person"
   t_has_one :project_manager, :foreign_key => "project_id"  # within class named SecretProject
   t_has_one :boss, :readonly => :true
   t_has_one :attachment, :as => :attachable