So, I'm doing RoR work again, and I'm hitting those annoying little issues that bugged me the first time around.
Today, it's the fact that I have to setup separate validations to handle nils/blanks. IMO I should be able to do this:
validates_numericality_of :elevation, :allow_nil => false
Now, this works. It validates that elevation is a number
(
Read more... )
Comments 3
validates_numericality_of :elevation, :allow_blank => true
From the api
:allow_blank - If set to true, skips this validation if the attribute is blank (default is false).
Reply
validates_presence_of :elevation
validates_numericality_of :elevation, allow_blank => true
Reply
Reply
Leave a comment