Looking at the source code , they do the same - belongs_to is a reference alias:
def references(*args) options = args.extract_options! polymorphic = options.delete(:polymorphic) args.each do |col| column("#{col}_id", :integer, options) column("#{col}_type", :string, polymorphic.is_a?(Hash) ? polymorphic : options) unless polymorphic.nil? end end alias :belongs_to :references
This is just a way to make your code more readable - it's nice to be able to carry belongs_to into your migrations when necessary, and stick to references for other kinds of associations.
muffinista Oct 17 2018-11-11T00: 00Z
source share