In Ruby and RoR, I often find that an object exists, that is, whether the properties of the object meet certain criteria. For instance:
if params[:id] && params[:id].size == 40
...do stuff
end
Is there a more efficient way to do this? Sort of:
if params[:id].size == 40 rescue false
but not using salvation?
source
share