Created
June 1, 2013 05:54
-
-
Save is8r/5689429 to your computer and use it in GitHub Desktop.
ActiveRecordのカラムをdestroyしていた場合、該当カラムの有無を検索したい時
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
if !Xxx.find_by_id(3).nil? | |
re = Xxx.find(3).name | |
else | |
re = "該当のカラムは削除されています。" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment