We've moved discussions to Discord

Updated: enabled Jumpstart.register_with_account? functionality, no longer able to sign up

Matt Bjornson
I just updated to master and noticed a couple of test failing. With I originally had some code in the registrations#build_resource, I have commented it out so it's the vanilla devise controller... Seems devise is expecting an account to be there.... Both the account and the test user are new.

Here is the error I'm getting in my log file in dev, 

Processing by Users::RegistrationsController#create as JS
20:57:30 web.1     |   Parameters: {"authenticity_token"=>"RERM9QsfxWmv/DOrh0DrL67sIfFiitsLJ3RB7fp9OImImOtoss1laK61/TmLZ0Hijc/sZdTsMvv2Ml6E9xe4NA==", "user"=>{"owned_accounts_attributes"=>{"0"=>{"name"=>"[FILTERED]"}}, "name"=>"[FILTERED]", "email"=>"[FILTERED]", "password"=>"[FILTERED]", "time_zone"=>"Eastern Time (US & Canada)", "terms_of_service"=>"1"}, "kewcgysbnafu"=>"", "button"=>""}
20:57:30 web.1     |    (0.1ms)  BEGIN
20:57:30 web.1     |   ↳ lib/jumpstart/lib/jumpstart/account_middleware.rb:30:in `call'
20:57:30 web.1     |   User Exists? (0.8ms)  SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2  [["email", "michael@theoffice.com"], ["LIMIT", 1]]
20:57:30 web.1     |   ↳ lib/jumpstart/lib/jumpstart/account_middleware.rb:30:in `call'
20:57:30 web.1     |   AccountUser Exists? (0.5ms)  SELECT 1 AS one FROM "account_users" WHERE "account_users"."user_id" IS NULL AND "account_users"."account_id" IS NULL LIMIT $1  [["LIMIT", 1]]
20:57:30 web.1     |   ↳ lib/jumpstart/lib/jumpstart/account_middleware.rb:30:in `call'
20:57:30 web.1     |   Account Exists? (0.4ms)  SELECT 1 AS one FROM "accounts" WHERE "accounts"."name" = $1 LIMIT $2  [["name", "Dunder Mifflin"], ["LIMIT", 1]]
20:57:30 web.1     |   ↳ lib/jumpstart/lib/jumpstart/account_middleware.rb:30:in `call'
20:57:30 web.1     |   CACHE User Exists? (0.0ms)  SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2  [["email", "michael@theoffice.com"], ["LIMIT", 1]]
20:57:30 web.1     |   ↳ lib/jumpstart/lib/jumpstart/account_middleware.rb:30:in `call'
20:57:30 web.1     |    (0.2ms)  ROLLBACK
20:57:30 web.1     |   ↳ lib/jumpstart/lib/jumpstart/account_middleware.rb:30:in `call'
20:57:30 web.1     |   Rendering devise/registrations/new.html.erb within layouts/application
20:57:30 web.1     |   Rendered shared/_error_messages.html.erb (Duration: 0.5ms | Allocations: 214)
20:57:31 web.1     |   Rendered devise/shared/_links.html.erb (Duration: 0.2ms | Allocations: 94)
20:57:31 web.1     |   Rendered devise/shared/_form_block.html.erb (Duration: 0.0ms | Allocations: 9)
20:57:31 web.1     |   Rendered devise/registrations/new.html.erb within layouts/application (Duration: 7.9ms | Allocations: 7976)
20:57:31 web.1     |   Rendered shared/_favicons.html.erb (Duration: 0.0ms | Allocations: 5)
20:57:31 web.1     |   Rendered shared/_payments_dependencies.html.erb (Duration: 2.0ms | Allocations: 2323)
20:57:31 web.1     |   Rendered shared/_flash.html.erb (Duration: 0.1ms | Allocations: 62)
20:57:31 web.1     |   Rendered shared/_left_nav.html.erb (Duration: 0.1ms | Allocations: 41)
20:57:31 web.1     |   Rendered shared/_right_nav.html.erb (Duration: 0.3ms | Allocations: 326)
20:57:31 web.1     |   Rendered shared/_navbar.html.erb (Duration: 0.8ms | Allocations: 659)
20:57:31 web.1     |   Rendered shared/_footer.html.erb (Duration: 0.2ms | Allocations: 159)
20:57:31 web.1     | Completed 200 OK in 162ms (Views: 14.5ms | ActiveRecord: 2.0ms | Allocations: 32173)
20:57:31 web.1     |
20:57:31 web.1     |
20:57:31 web.1     | Zeitwerk@rails.main: constant Notable::Request loaded from file /Users/matt/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/notable-0.3.1/app/models/notable/request.rb
20:57:31 web.1     |    (0.1ms)  BEGIN
20:57:31 web.1     |   Notable::Request Create (2.6ms)  INSERT INTO "notable_requests" ("note_type", "note", "action", "status", "url", "request_id", "ip", "user_agent", "referrer", "params", "request_time", "created_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING "id"  [["note_type", "Validation Errors"], ["note", "User: Account must exist"], ["action", "users/registrations#create"], ["status", 200], ["url", "http://localhost:5000/users"], ["request_id", "297ea2f8-e417-4bac-bbc1-cabbfce1c377"], ["ip", "::1"], ["user_agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Firefox/78.0"], ["referrer", "http://localhost:5000/users/sign_up"], ["params", "{\"authenticity_token\":\"RERM9QsfxWmv/DOrh0DrL67sIfFiitsLJ3RB7fp9OImImOtoss1laK61/TmLZ0Hijc/sZdTsMvv2Ml6E9xe4NA==\",\"user\":{\"owned_accounts_attributes\":{\"0\":{\"name\":\"[FILTERED]\"}},\"name\":\"[FILTERED]\",\"email\":\"[FILTERED]\",\"password\":\"[FILTERED]\",\"time_zone\":\"Eastern Time (US \\u0026 Canada)\",\"terms_of_service\":\"1\"},\"kewcgysbnafu\":\"\",\"button\":\"\"}"], ["request_time", 0.166128], ["created_at", "2020-07-15 01:57:31.031645"]]
Chris Oliver
Matt, your logs show:

20:57:30 web.1     |   CACHE User Exists? (0.0ms)  SELECT 1 AS one FROM "users" WHERE "users"."email" = $1 LIMIT $2  [["email", "michael@theoffice.com"], ["LIMIT", 1]]
20:57:30 web.1     |   ↳ lib/jumpstart/lib/jumpstart/account_middleware.rb:30:in `call'
20:57:30 web.1     |    (0.2ms)  ROLLBACK

Which looks like it's rolling back because you've already got a user with that email in the db.
Matt Bjornson
Thanks Chris, I appreciate your response! That's weird, I don't show that email in my db...
Chris Oliver
Then it's another validation error on your model.
Matt Bjornson
I believe its this one... "User: Account must exist", or am I wrong ( this is not an invited user and the account doesn't exist)
Notifications
You’re not receiving notifications from this thread.