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 am creating a new record.
I tried these methods,
1) :on => { :create } options is not working.
2) before_save :check_duplication
def check_duplication
ModelName.validates_**_of :email
end
But still snatching my head over it.. IF these two ways are not working
what way it will work?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.