def t_has_many(name, options={})
      extend(Associations::HasMany::ClassMethods)
      association = _t_create_association(:t_has_many, name, options)
      initialize_has_many_association(association)

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

      define_method("#{association.name}=") do |associates|
        _t_mark_dirty if respond_to?(:_t_mark_dirty)
        set_associate(association, associates) do
          set_has_many_associates(association, associates)
        end
      end

      define_method("#{ActiveSupport::Inflector.singularize(association.name.to_s)}_ids") do
        has_many_associate_ids(association)
      end

      define_method("#{ActiveSupport::Inflector.singularize(association.name.to_s)}_ids=") do |associate_ids|
        _t_mark_dirty if respond_to?(:_t_mark_dirty)
        set_has_many_associate_ids(association, associate_ids)
      end

      private

      define_method(:_t_save_without_callback) do
        save_without_callback
      end
    end
def t_has_many(name, options={})
      extend(Associations::HasMany::ClassMethods)
      association = _t_create_association(:t_has_many, name, options)
      initialize_has_many_association(association)

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

      define_method("#{association.name}=") do |associates|
        _t_mark_dirty if respond_to?(:_t_mark_dirty)
        set_associate(association, associates) do
          set_has_many_associates(association, associates)
        end
      end

      define_method("#{ActiveSupport::Inflector.singularize(association.name.to_s)}_ids") do
        has_many_associate_ids(association)
      end

      define_method("#{ActiveSupport::Inflector.singularize(association.name.to_s)}_ids=") do |associate_ids|
        _t_mark_dirty if respond_to?(:_t_mark_dirty)
        set_has_many_associate_ids(association, associate_ids)
      end

      private

      define_method(:_t_save_without_callback) do
        save_without_callback
      end
    end
Specifies a one-to-many association.

 The following methods for retrieval and query of collections of associated objects will be added:

 [collection(force_reload = false)]
   Returns an array of all the associated objects.
   An empty array is returned if none are found.
 [collection<<(object, ...)]
   Adds one or more objects to the collection by setting their foreign keys to the collection's primary key.
 [collection.push(object, ...)]
   Adds one or more objects to the collection by setting their foreign keys to the collection's primary key.
 [collection.concat(other_array)]
   Adds the objects in the other array to the collection by setting their foreign keys to the collection's primary key.
 [collection.delete(object, ...)]
   Removes one or more objects from the collection by setting their foreign keys to +NULL+.
   Objects will be in addition deleted and callbacks called if they're associated with <tt>:dependent => :destroy</tt>,
   and deleted and callbacks skipped if they're associated with <tt>:dependent => :delete_all</tt>.
 [collection.destroy_all]
   Removes all objects from the collection, and deletes them from their respective
   database. If the deleted objects have any delete callbacks defined, they will be called.
 [collection.delete_all]
   Removes all objects from the collection, and deletes them from their respective
   database. No delete callbacks will be called, regardless of whether or not they are defined.
 [collection=objects]
   Replaces the collections content by setting it to the list of specified objects.
 [collection_singular_ids]
   Returns an array of the associated objects' ids
 [collection_singular_ids=ids]
   Replace the collection with the objects identified by the primary keys in +ids+.
 [collection.clear]
   Removes every object from the collection. This deletes the associated objects and issues callbacks
   if they are associated with <tt>:dependent => :destroy</tt>, deletes them directly from the
   database without calling any callbacks if <tt>:dependent => :delete_all</tt>, otherwise sets their
   foreign keys to +NULL+.
 [collection.empty?]
   Returns +true+ if there are no associated objects.
 [collection.size]
   Returns the number of associated objects.

 (*Note*: +collection+ is replaced with the symbol passed as the first argument, so
 <tt>t_has_many :clients</tt> would add among others <tt>clients.empty?</tt>.)

 === Example

 Example: A Firm class declares <tt>t_has_many :clients</tt>, which will add:
 * <tt>Firm#clients</tt> (similar to <tt>Clients.find :all, :conditions => ["firm_id = ?", id]</tt>)
 * <tt>Firm#clients<<</tt>
 * <tt>Firm#clients.delete</tt>
 * <tt>Firm#clients=</tt>
 * <tt>Firm#client_ids</tt>
 * <tt>Firm#client_ids=</tt>
 * <tt>Firm#clients.clear</tt>
 * <tt>Firm#clients.empty?</tt> (similar to <tt>firm.clients.size == 0</tt>)
 * <tt>Firm#clients.size</tt> (similar to <tt>Client.count "firm_id = #{id}"</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_many :products</tt> will by default be linked
   to the Product class, but if the real class name is SpecialProduct, 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_many+
   association will use "person_id" as the default <tt>:foreign_key</tt>.
 [:dependent]
   If set to <tt>:destroy</tt> all the associated objects are deleted alongside this object
   in addition to calling their delete callbacks.  If set to <tt>:delete_all</tt> all
   associated objects are deleted *without* calling their delete callbacks.  If set to
   <tt>:nullify</tt> all associated objects' foreign keys are set to +NULL+ *without* calling
   their save backs.
 [:readonly]
   If true, all the associated objects are readonly through the association.
 [:limit]
   An integer determining the limit on the number of rows that should be returned. Results
   are ordered by a string representation of the id.
 [:offset]
   An integer determining the offset from where the rows should be fetched. So at 5, it would skip the first 4 rows.
   Results are ordered by a string representation of the id.
 [:autosave]
   If true, always save any loaded members and destroy members 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_many :products, :class_name => "SpecialProduct"
   t_has_many :engineers, :foreign_key => "project_id"  # within class named SecretProject
   t_has_many :tasks, :dependent => :destroy
   t_has_many :reports, :readonly => true
   t_has_many :tags, :as => :taggable