I’m trying to make a model validation that starts only if a given
attribute has a specified value, but it seems i’m doing something wrong
I have 3 values: respond_via, email, telephone_number. I want the latter
ones to validate only if respond_via has specific value.
So far i have:
validates_presence_of :email, :if => (:respond_via == “e-mail”)
validates_presence_of :telephone_number, :if => (:respond_via ==
, but this version raises undefined method `respond_via’ exception.
I am sure it is defined, so it must be my syntax that is to blame. Any