One method you can use is the exists?
active record method, like so:
@issue = Issue.where(id: 1)
if @issue.exists?
# do something if it exists
else
# do something if it is missing
end
Side note: Since you're attempting to find by id
, you don't necessarily need the .where
portion; you can simply do: Issue.exists?(1)
.