Created
July 9, 2016 16:26
-
-
Save acuppy/47b6afc5dc6eed4c4eb67aeb5d85f8b2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# 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