Validates_presence_of - only on edit


#1

Ok so not sure if this is possible but it would help out a lot if it
is. I am trying to put this validation on one of my forms

validates_presence_of :name, :state

however I only need this validation to run when they edit this form,
not when they create it. is this possible, any suggestions would be
greatly appreciated. thanks in advance.


#2

Ok so not sure if this is possible but it would help out a lot if it
is. I am trying to put this validation on one of my forms

validates_presence_of :name, :state

however I only need this validation to run when they edit this form,
not when they create it. is this possible, any suggestions would be
greatly appreciated. thanks in advance.

Check the docs… it’s in there.

on - Specifies when this validation is active (default is :save,

other options :create, :update).

validates_presence_of :name, :state, :on => :update

-philip


#3

hey thanks that was the trick, much appreciated


#4

hey thanks that was the trick, much appreciated