Check out example codes for "Add references rails migration". It will help you in understanding the concepts better.

Code Example 1

class AddUserToUploads < ActiveRecord::Migration
  def change
    add_reference :uploads, :user, index: true
  end
end

Code Example 2

rails g migration AddUserToUploads user:references

Learn ReactJs, React Native from akashmittal.com