[rspec-users] Question on SQL exceptions
Pat Maddox
pat.maddox at gmail.com
Mon Mar 9 22:04:40 EDT 2009
On Mar 9, 2009, at 1:53 PM, James Byrne wrote:
> Pat Maddox wrote:
>> ActiveRecord doesn't know anything about db constraint errors. If
>> one
>> is violated, the error propagates up in the form of an exception.
>>
>
> I realize that, but the exception is of the
> ActiveRecord:StatementInvalid class, which I should be able to catch
> in
> the controller with a rescue clause. But, I am not getting this to
> work
> at the moment.
Not sure what your problem is. Here's a gist that demonstrates what
you're trying to do, and works fine. http://gist.github.com/76667
Pat
More information about the rspec-users
mailing list