I usually do
value = input || "default"
so if input = nil
value = "default"
But how can I do this so instead of nil It also counts an empty string '' as nil
I want so that if I do
input = ''
value = input || "default"
=> "default"
Is there a simple elegant way to do this without if?
Rails adds presence method to all object that does exactly what you want