Skip to content

Instantly share code, notes, and snippets.

@acuppy
Created July 9, 2016 16:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save acuppy/47b6afc5dc6eed4c4eb67aeb5d85f8b2 to your computer and use it in GitHub Desktop.
class AddAdminToUsers < ActiveRecord::Migration
# Fill the void
class User < ActiveRecord::Base
end unless defined? ::User
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