This seems like a simple question, but it seems that I can not find the answer to the question about writing custom validators. I have this validator
validates :password, :presence => true, :confirmation => true, :length => { :minimum => 5}
there are more rules, such as some regex for complexity, but that gives the gist.
The problem is that I want the application to be created only for creation, everything else needs to be created and updated. Since the user may not change the password when updating his information.
I tried to break the rules
validates :password, :presence => true, :on => :create validates :password,
This led to ignoring all the rules for updating. Is there an easy way to apply only one rule to create, and the rest to everything?
source share