This project is archived and is in readonly mode.
Uniqueness validator can cause error with after_initialize callback
-
Adam Meehan
- Tag changed from activerecord, patch, validates_uniqueness_of, validations to activerecord, patch, performance, validates_uniqueness_of, validations
-
Kane
I encountered this too and monkey patched it in my app.
I used STI and wanted to deny instantiation of the base class (kind of abstract).
This class had a validates_uniqueness defined.Your diff is more than you wanted.
Also i would suggest to fix the underlying problem, which is 'exists?' .
there is no need for instantiation. -
Marcelo Giorgi
- No changes were found…
-
Adam Meehan
Whoops, thanks for the heads up on the patch. Fixed now.
A change to exists? caused too many errors to fix now. Will revisit.
-
Santiago Pastorino
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
-
Kane
Changeset [827e5de60f27c6b559640eda7b79857050a72d9e] by Andrew White
exists? no longer instantiates records, so this should be solved.
