Created
June 11, 2015 13:05
-
-
Save dhirajbajaj/fadc81d30f1dad3b518b to your computer and use it in GitHub Desktop.
Rails remove multiple columns except few
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
tbr_models = Model.column_names - ['id', 'name', ... , 'created_at', 'updated_at'] | |
tbr_models.each do |model_column| | |
remove_column :models, model_column | |
puts "-- #{model_column}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment