Last active
December 17, 2015 09:19
-
-
Save DVG/5586420 to your computer and use it in GitHub Desktop.
Conditional alias attribute for changing a column name if the migrations haven't been run yet. Useful if your code deploy can possibly happen before you rmigration
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
unless self.column_names.include? "new_name" | |
alias_attribute :new_name, :old_name | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment