Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: NameError (uninitialized constant ActiveRecord::RecordNotUnique)

I have a problem with my rails app. I get the following Error:

NameError (uninitialized constant ActiveRecord::RecordNotUnique)

Im not sure why this is as it works on my development environment. The exception gets tested by:

    begin
      ...
    rescue ActiveRecord::RecordNotUnique
      next
    end

Lg Markus

like image 845
Markus Avatar asked Jan 31 '26 02:01

Markus


1 Answers

When are you seeing this problem i.e. test, production?

What version of ActiveRecord do you have on this environment?

Update:

As far as I am aware ActiveRecord::RecordNotUnique became available in version 3.0.0 onwards apidock.com/rails/ActiveRecord/RecordNotUnique You need to have this version or greater to use this database exception.

like image 189
charliequinn Avatar answered Feb 01 '26 15:02

charliequinn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!