Skip to content

Instantly share code, notes, and snippets.

@acuppy
Last active July 9, 2016 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acuppy/f50a46049c479a78da5bf524dc3066ec to your computer and use it in GitHub Desktop.
Save acuppy/f50a46049c479a78da5bf524dc3066ec to your computer and use it in GitHub Desktop.
class AddAdminToUsers < ActiveRecord::Migration
def change
add_column :users, :admin, :boolean, default: false
# convert existing users to admin
User.reset_column_information
User.find_each do |u|
u.update admin: true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment