3 ms·
nonexistent does not necessarily imply invalid. I don't use rails, so take my ignorance into account, but I'd hate to catch exceptions all the time instead of j
by RegEx 14y ago
nonexistent does not necessarily imply invalid. I don't use rails, so take my ignorance into account, but I'd hate to catch exceptions all the time instead of just checking for falsey values.
Ex: "Enter your student ID"
s = Student.find_by_id(params[:id])
if s
# do stuff
else
# do other stuff
end
vs
begin
s = Student.find_by_id(params[:id])
# do stuff
rescue
# do other stuff
end