Skip to content

Instantly share code, notes, and snippets.

@is8r
Created June 1, 2013 05:54
Show Gist options
  • Save is8r/5689429 to your computer and use it in GitHub Desktop.
Save is8r/5689429 to your computer and use it in GitHub Desktop.
ActiveRecordのカラムをdestroyしていた場合、該当カラムの有無を検索したい時
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