rails change_table add reference code example
Example 1: Add references rails migration
rails g migration AddUserToUploads user:references
Example 2: Add references rails migration
class AddUserToUploads < ActiveRecord::Migration
def change
add_reference :uploads, :user, index: true
end
end