Last active
July 9, 2016 16:26
-
-
Save acuppy/f50a46049c479a78da5bf524dc3066ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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