class ActiveRecord::ConnectionAdapters::Table

def references(*args)

t.belongs_to(:goat)
t.references(:goat, :polymorphic => true)
t.references(:goat)
===== Examples
references and belongs_to are acceptable.
Adds a reference. Optionally adds a +type+ column.
def references(*args)
  options = args.extract_options!
  polymorphic = options.delete(:polymorphic)
  args.each do |col|
    @base.add_column(@table_name, "#{col}_id", :integer, options)
    @base.add_column(@table_name, "#{col}_type", :string, polymorphic.is_a?(Hash) ? polymorphic : options) unless polymorphic.nil?
  end
end