Why is Rails saving invalid records?!
Ok there are a few ways this might happen, particularly if you've deliberately bypassed validations. But you're not an idiot. You haven't done that. If you're using devise this might be your answer...
- Are you using the "confirmable" feature that requires a user has to confirm their email address?
- Did you ever directly use the method it makes available on the model named
confirm
?
There's your trouble!
Devise has a horrible horrible default on that method to ignore validations and force save.
Do this instead
confirm(ensure_valid: true)
Written by Adam
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#