On Nov 10, 2007, at 3:41 AM, Jeremy Kemper wrote:
> Hey Ara, a one-two punch of validates_uniqueness_of plus a unique > index on those fields gives you nice error messages in the common case > and a rare database exception otherwise. This should definitely be in > the docs. that's fair enough and a great start imho. i've never contributed docs but know marcel is the gatekeeper - what's the protocol? > > Now, if we could parse the db constraint violation error message to > deduce the type of constraint that failed and the affected fields, > then we could turn the dumb exception (StatementInvalid) into a smart > one (UniquenessConstraintViolation), rescue it in > Base#save_with_validations, and add the message to record.errors. > Unfortunately I tried it with postgres a while back and the db errors > left too much up to the imagination to get much further than a neat > demo. > i played with this a bit and you are quite right. this is quite interesting http://drawohara.tumblr.com/post/19178992 but of little practical value. serialized transactions work too of course - sans speed. cheers. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---