Rails is skipping the :format validation on create. On create, it’s accepting anything at all. Then on update :presence and :format are both working as expected. How can I alter this so it’ll :allow_blank on create and check the format too?
validates :mail, :allow_blank => true, :on => :create,
:format => { :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)*[a-z]{2,})$/i },
:length => { :maximum => 60 },
:presence => true, :on => :update
Try using separate
validatesstatements for :create, :update, and all life cycle events. Your:on => :updateoption is essentially overwriting the:on => :createoption when you lump them all together.