Topic: validates_uniqueness_of and error handeling
I have to check that a pair of information cannot be added twice, so I wrote this line in my conroller :
validates_uniqueness_of :source_id, :scope => "view_id"
(my view has many sources, but all different)
This seems to work fine, except that if I add an already existing record, I get a big error page that tells me it already exists... the thing is that i do not want this page, i just want that the record is not added and maybe a flash to tell the user about it. How could I handle such error messages ?
Last edited by adamas (2006-11-28 05:59:51)