def associate(model, options = {})
      options[:only]       = Array(options[:only])
      options[:except]     = Array(options[:except])
      options[:depends_on] = Array(options[:depends_on])

      options = {
        delegate: true
      }.merge(options)

      associate = build_associate(model, options)
      self.associates << associate

      define_associate_delegation(associate) if options[:delegate]
      define_associate_instance_setter_method(associate)
      define_associate_instance_getter_method(associate)
    end
def associate(model, options = {})
      options[:only]       = Array(options[:only])
      options[:except]     = Array(options[:except])
      options[:depends_on] = Array(options[:depends_on])

      options = {
        delegate: true
      }.merge(options)

      associate = build_associate(model, options)
      self.associates << associate

      define_associate_delegation(associate) if options[:delegate]
      define_associate_instance_setter_method(associate)
      define_associate_instance_getter_method(associate)
    end
Defines an associated model

 @example
   class User
     include Associates

     associate :user, only: :username
   end

 @param model [Symbol, Class]
 @param [Hash] options
 @option options [Symbol, Array] :only Only generate methods for the given attributes

 @option options [Symbol, Array] :except Generate all the model's methods except
   for the given attributes

 @option options [Symbol] :depends_on Specify one or more associate name on
   which the current associate model depends to be valid. Allow to automatically
   setup `belongs_to` associations between models

 @option options [String, Class] :class_name Specify the class name of the associate.
   Use it only if that name can’t be inferred from the associate's name

 @option options [Boolean] :delegate (true) Wether or not to delegate the associate's
   attributes getter and setters methods to the associate instance