Skip to content

Instantly share code, notes, and snippets.

@DVG
Last active December 17, 2015 09:19
Show Gist options
  • Save DVG/5586420 to your computer and use it in GitHub Desktop.
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
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