activerecord - Validate uniqueness only on create - what am I typing wrong? Example provided -


i have code :

 class member extends activerecord\model   {    static $validates_uniqueness_of = array(       array('name', 'message' => "that name has been registered. please choose another", 'on' => 'create'),       array('email', 'message' => "that email has been registered. please choose another", 'on' => 'create')    );   } 

the problem checks uniqueness when update. don't want that. when create.

what typing wrong?

try like

validates_uniqueness_of :name, :on => :create validates_uniqueness_of :email, :on => :create 

this should trick already, give try =)


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -