[Rails] validates_uniqueness_of problem

2010-09-21 Thread giorgio
I have an after_save callback when I save an Organisation record. def after_save #create an admin user for this organisation if self.users.size.zero? user=User.new(:organisation_id=self.id, :first_name = Admin, :last_name = User, :logon_name = admin,

[Rails] Validates_uniqueness_of problem

2010-02-11 Thread Hemant Bhargava
Hi guys, I have given a validation function (validates_uniqueness_of :email) in my model because i want email to be unique. So the problem is that whenever i want to update a record then also it validates. I mean i dont want it to validate while updating the record. It should happen only when i

Re: [Rails] Validates_uniqueness_of problem

2010-02-11 Thread Mat Brown
On Thu, Feb 11, 2010 at 05:37, Hemant Bhargava li...@ruby-forum.com wrote: Hi guys, I have given a validation function (validates_uniqueness_of :email) in my model because i want email to be unique. So the problem is that whenever i want to update a record then also it validates. I mean i