forked from DMPRoadmap/roadmap
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActiveRecord::RecordInvalid: Validation failed: Email has already been taken #900
Comments
aaronskiba
added a commit
that referenced
this issue
Sep 16, 2024
This change adds the PR idea from #902. The change seeks to address the following issue: #900 Co-Authored-By: Omar Rodriguez Arenas <[email protected]>
3.1.4 :001 > User.find_by!(email: '[email protected]')
User Load (3.9ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "[email protected]"], ["LIMIT", 1]]
=> #<User id: 26479, firstname: "test", surname: "test", email: "[email protected]", created_at: "2024-10-10 17:13:10.783440000 +0000", updated_at: "2024-10-10 17:13:10.783440000 +0000", other_organisation: nil, dmponline3: nil, accept_terms: true, org_id: 59, api_token: nil, language_id: 1, recovery_email: nil, active: true, department_id: nil, last_api_access: nil, prefs:
3.1.4 :002 > user = User.find_or_initialize_by(email: '[email protected]')
User Load (3.8ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "[email protected]"], ["LIMIT", 1]]ise.friendly_token[0, 20])
Language Load (2.2ms) SELECT "languages".* FROM "languages" WHERE "languages"."default_language" = $1 ORDER BY "languages"."id" ASC LIMIT $2 [["default_language", true], ["LIMIT", 1]]
3.1.4 :003 > user.new_record?
=> true
3.1.4 :004 > user.update!(firstname: 'test', surname: 'test', org: Org.find_by(is_other: true), accept_terms: true, password
: Devise.friendly_token[0, 20])
Org Load (3.2ms) SELECT "orgs".* FROM "orgs" WHERE "orgs"."is_other" = $1 LIMIT $2 [["is_other", true], ["LIMIT", 1]]
TRANSACTION (2.9ms) BEGIN
User Exists? (2.1ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2 [["email", "[email protected]"], ["LIMIT", 1]]
Language Load (1.0ms) SELECT "languages".* FROM "languages" WHERE "languages"."id" = $1 LIMIT $2 [["id", 1], ["LIMIT", 1]]
TRANSACTION (2.7ms) ROLLBACK
/usr/share/rvm/gems/ruby-3.1.4/gems/activerecord-6.1.7.8/lib/active_record/validations.rb:80:in `raise_validation_error': Validation failed: Email has already been taken (ActiveRecord::RecordInvalid) The error seems to be caused due |
aaronskiba
added a commit
that referenced
this issue
Oct 10, 2024
This commit is intended to resolve the following issue: #900
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
View details in Rollbar: https://app.rollbar.com/a/ualbertalib/fix/item/dmp_assistant/534
The text was updated successfully, but these errors were encountered: