I want to set a default value if the variable is not set.
Here are valid values (which should not get overwritten): true false 0 1 "some string"
Here is how I'm currently trying to do this. Is this the right way?
before_save :set_defaults
def set_defaults
self.is_approved = false if self.is_approved.nil?
end
If this is indeed correct, is there a better syntax? In PHP we had isset() for this sort of stuff.