(0.4ms) BEGIN  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) ROLLBACK  (0.1ms) BEGIN  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#destroy as HTML Redirected to http://test.host/signed_out Completed 302 Found in 1ms (ActiveRecord: 0.0ms)  (0.2ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#destroy as HTML Redirected to http://test.host/ Completed 302 Found in 0ms (ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#create as HTML Parameters: {"provider"=>"bookingsync"} Account Load (0.5ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.1ms) SAVEPOINT active_record_1 Account Exists (0.3ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.4ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:39:34.097391"], ["updated_at", "2017-04-26 15:39:34.097391"]]  (0.1ms) RELEASE SAVEPOINT active_record_1 Redirected to http://test.host/admin Completed 302 Found in 31ms (ActiveRecord: 4.8ms)  (0.2ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#create as HTML Parameters: {"provider"=>"bookingsync"} Account Load (0.2ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.1ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:39:34.104015"], ["updated_at", "2017-04-26 15:39:34.104015"]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Redirected to http://test.host/ Completed 302 Found in 3ms (ActiveRecord: 0.6ms)  (0.2ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#create as HTML Parameters: {"provider"=>"bookingsync"} Account Load (0.2ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.5ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.2ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:39:34.110597"], ["updated_at", "2017-04-26 15:39:34.110597"]]  (0.1ms) RELEASE SAVEPOINT active_record_1 Redirected to http://test.host/ Completed 302 Found in 4ms (ActiveRecord: 1.1ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#failure as HTML Rendered /var/www/bookingsync/bookingsync-engine/app/views/sessions/failure.html.erb within layouts/application (0.2ms) Completed 200 OK in 5ms (Views: 5.3ms | ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#failure as HTML Rendered /var/www/bookingsync/bookingsync-engine/app/views/sessions/failure.html.erb within layouts/application (0.2ms) Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.2ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.6ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["synced_id", 123], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh_token"], ["oauth_expires_at", "1493307574"], ["created_at", "2017-04-26 15:39:34.126702"], ["updated_at", "2017-04-26 15:39:34.126702"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.1ms) ROLLBACK  (0.0ms) BEGIN Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["synced_id", 123], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh_token"], ["oauth_expires_at", "1493134774"], ["created_at", "2017-04-26 15:39:34.131460"], ["updated_at", "2017-04-26 15:39:34.131460"]]  (0.3ms) COMMIT  (0.0ms) BEGIN  (0.0ms) BEGIN Account Exists (0.5ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" = 123 AND "accounts"."id" != 5) LIMIT 1 SQL (0.2ms) UPDATE "accounts" SET "oauth_access_token" = $1, "oauth_refresh_token" = $2, "oauth_expires_at" = $3, "updated_at" = $4 WHERE "accounts"."id" = $5 [["oauth_access_token", "refreshed_token"], ["oauth_refresh_token", "refreshed_refresh_token"], ["oauth_expires_at", "1493393974"], ["updated_at", "2017-04-26 15:39:34.149332"], ["id", 5]]  (1.3ms) COMMIT  (0.1ms) ROLLBACK Account Load (0.2ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1 [["id", 5]] Account Load (0.1ms) SELECT "accounts".* FROM "accounts"  (0.0ms) BEGIN SQL (0.1ms) DELETE FROM "accounts" WHERE "accounts"."id" = $1 [["id", 5]]  (0.3ms) COMMIT  (0.0ms) BEGIN Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.2ms) INSERT INTO "accounts" ("synced_id", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["synced_id", 123], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh_token"], ["oauth_expires_at", "1493134774"], ["created_at", "2017-04-26 15:39:34.157104"], ["updated_at", "2017-04-26 15:39:34.157104"]]  (0.3ms) COMMIT  (0.1ms) BEGIN Account Exists (0.3ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" = 123 AND "accounts"."id" != 6) LIMIT 1 SQL (0.2ms) UPDATE "accounts" SET "oauth_access_token" = $1, "oauth_refresh_token" = $2, "oauth_expires_at" = $3, "updated_at" = $4 WHERE "accounts"."id" = $5 [["oauth_access_token", "refreshed_token"], ["oauth_refresh_token", "refreshed_refresh_token"], ["oauth_expires_at", "1493393974"], ["updated_at", "2017-04-26 15:39:34.161035"], ["id", 6]]  (0.3ms) COMMIT Account Load (0.2ms) SELECT "accounts".* FROM "accounts"  (0.0ms) BEGIN SQL (0.1ms) DELETE FROM "accounts" WHERE "accounts"."id" = $1 [["id", 6]]  (0.2ms) COMMIT  (0.0ms) BEGIN  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.3ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" IS NULL LIMIT 1 SQL (0.2ms) INSERT INTO "accounts" ("oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["oauth_access_token", "token"], ["oauth_refresh_token", "refresh"], ["oauth_expires_at", "expires"], ["created_at", "2017-04-26 15:39:34.196953"], ["updated_at", "2017-04-26 15:39:34.196953"]]  (0.1ms) RELEASE SAVEPOINT active_record_1  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" IS NULL AND "accounts"."id" != 7) LIMIT 1 SQL (0.1ms) UPDATE "accounts" SET "oauth_access_token" = $1, "oauth_refresh_token" = $2, "oauth_expires_at" = $3, "updated_at" = $4 WHERE "accounts"."id" = $5 [["oauth_access_token", nil], ["oauth_refresh_token", nil], ["oauth_expires_at", nil], ["updated_at", "2017-04-26 15:39:34.199160"], ["id", 7]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Load (0.4ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1 [["id", 7]]  (0.1ms) ROLLBACK  (0.0ms) BEGIN Account Load (0.4ms) SELECT "accounts".* FROM "accounts" ORDER BY "accounts"."id" ASC LIMIT 1  (0.1ms) SAVEPOINT active_record_1 SQL (0.2ms) INSERT INTO "accounts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2017-04-26 15:39:34.207528"], ["updated_at", "2017-04-26 15:39:34.207528"]]  (0.1ms) RELEASE SAVEPOINT active_record_1  (0.0ms) SAVEPOINT active_record_1 SQL (0.2ms) UPDATE "accounts" SET "synced_id" = $1, "updated_at" = $2 WHERE "accounts"."id" = $3 [["synced_id", 0], ["updated_at", "2017-04-26 15:39:34.209310"], ["id", 8]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Exists (0.3ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 0 LIMIT 1  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:39:34.219445"], ["updated_at", "2017-04-26 15:39:34.219445"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.2ms) SELECT COUNT(*) FROM "accounts" Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.2ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:39:34.224876"], ["updated_at", "2017-04-26 15:39:34.224876"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.2ms) SELECT COUNT(*) FROM "accounts"  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (1.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.2ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:39:34.235230"], ["updated_at", "2017-04-26 15:39:34.235230"]]  (0.1ms) RELEASE SAVEPOINT active_record_1 Account Load (0.2ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.1ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:39:34.238252"], ["updated_at", "2017-04-26 15:39:34.238252"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.2ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.2ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:39:34.241211"], ["updated_at", "2017-04-26 15:39:34.241211"]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:39:34.243552"], ["updated_at", "2017-04-26 15:39:34.243552"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.0ms) ROLLBACK  (0.6ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:39:34.247047"], ["updated_at", "2017-04-26 15:39:34.247047"]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:39:34.249351"], ["updated_at", "2017-04-26 15:39:34.249351"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.0ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:39:34.252257"], ["updated_at", "2017-04-26 15:39:34.252257"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 123], ["created_at", "2017-04-26 15:39:34.253789"], ["updated_at", "2017-04-26 15:39:34.253789"]]  (0.1ms) RELEASE SAVEPOINT active_record_1 Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" = 123 AND "accounts"."id" != 18) LIMIT 1 SQL (0.1ms) UPDATE "accounts" SET "name" = $1, "oauth_access_token" = $2, "oauth_refresh_token" = $3, "oauth_expires_at" = $4, "updated_at" = $5 WHERE "accounts"."id" = $6 [["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["updated_at", "2017-04-26 15:39:34.255910"], ["id", 18]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.0ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:39:34.258865"], ["updated_at", "2017-04-26 15:39:34.258865"]]  (0.1ms) RELEASE SAVEPOINT active_record_1  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 123], ["created_at", "2017-04-26 15:39:34.260527"], ["updated_at", "2017-04-26 15:39:34.260527"]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.1ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" = 123 AND "accounts"."id" != 20) LIMIT 1 SQL (0.1ms) UPDATE "accounts" SET "name" = $1, "oauth_access_token" = $2, "oauth_refresh_token" = $3, "oauth_expires_at" = $4, "updated_at" = $5 WHERE "accounts"."id" = $6 [["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["updated_at", "2017-04-26 15:39:34.262841"], ["id", 20]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1 [["id", 20]]  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:39:34.266246"], ["updated_at", "2017-04-26 15:39:34.266246"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 123], ["created_at", "2017-04-26 15:39:34.267796"], ["updated_at", "2017-04-26 15:39:34.267796"]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" = 123 AND "accounts"."id" != 22) LIMIT 1 SQL (0.1ms) UPDATE "accounts" SET "name" = $1, "oauth_access_token" = $2, "oauth_refresh_token" = $3, "oauth_expires_at" = $4, "updated_at" = $5 WHERE "accounts"."id" = $6 [["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["updated_at", "2017-04-26 15:39:34.270013"], ["id", 22]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1 [["id", 22]]  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by AuthenticatedController#index as HTML Rendered text template (0.0ms) Filter chain halted as :authenticate_account! rendered or redirected Completed 200 OK in 1ms (Views: 1.1ms | ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by AuthenticatedController#index as HTML Redirected to http://test.host/auth/bookingsync/?account_id= Filter chain halted as :authenticate_account! rendered or redirected Completed 302 Found in 0ms (ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.1ms) BEGIN Processing by AuthenticatedController#index as JS Rendered text template (0.0ms) Filter chain halted as :authenticate_account! rendered or redirected Completed 401 Unauthorized in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by AuthenticatedController#index as JS Rendered text template (0.0ms) Filter chain halted as :authenticate_account! rendered or redirected Completed 401 Unauthorized in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms)  (0.0ms) ROLLBACK  (0.0ms) BEGIN  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) ROLLBACK  (0.0ms) BEGIN  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#create as HTML Parameters: {"provider"=>"bookingsync"} Account Load (0.4ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.1ms) SAVEPOINT active_record_1 Account Exists (0.3ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.3ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:41:50.571200"], ["updated_at", "2017-04-26 15:41:50.571200"]]  (0.1ms) RELEASE SAVEPOINT active_record_1 Redirected to http://test.host/ Completed 302 Found in 33ms (ActiveRecord: 4.5ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#create as HTML Parameters: {"provider"=>"bookingsync"} Account Load (0.3ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.1ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:41:50.580496"], ["updated_at", "2017-04-26 15:41:50.580496"]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Redirected to http://test.host/ Completed 302 Found in 4ms (ActiveRecord: 0.7ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#create as HTML Parameters: {"provider"=>"bookingsync"} Account Load (0.3ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.1ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.2ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:41:50.588669"], ["updated_at", "2017-04-26 15:41:50.588669"]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Redirected to http://test.host/admin Completed 302 Found in 4ms (ActiveRecord: 0.7ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#failure as HTML Rendered /var/www/bookingsync/bookingsync-engine/app/views/sessions/failure.html.erb within layouts/application (0.2ms) Completed 200 OK in 12ms (Views: 11.7ms | ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#failure as HTML Rendered /var/www/bookingsync/bookingsync-engine/app/views/sessions/failure.html.erb within layouts/application (0.0ms) Completed 200 OK in 1ms (Views: 0.4ms | ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.1ms) BEGIN Processing by SessionsController#destroy as HTML Redirected to http://test.host/signed_out Completed 302 Found in 0ms (ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by SessionsController#destroy as HTML Redirected to http://test.host/ Completed 302 Found in 0ms (ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by AuthenticatedController#index as HTML Redirected to http://test.host/auth/bookingsync/?account_id= Filter chain halted as :authenticate_account! rendered or redirected Completed 302 Found in 0ms (ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by AuthenticatedController#index as HTML Rendered text template (0.0ms) Filter chain halted as :authenticate_account! rendered or redirected Completed 200 OK in 4ms (Views: 4.0ms | ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by AuthenticatedController#index as JS Rendered text template (0.0ms) Filter chain halted as :authenticate_account! rendered or redirected Completed 401 Unauthorized in 0ms (Views: 0.3ms | ActiveRecord: 0.0ms)  (0.1ms) ROLLBACK  (0.0ms) BEGIN Processing by AuthenticatedController#index as JS Rendered text template (0.0ms) Filter chain halted as :authenticate_account! rendered or redirected Completed 401 Unauthorized in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms)  (0.0ms) ROLLBACK  (0.0ms) BEGIN  (0.1ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["synced_id", 123], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh_token"], ["oauth_expires_at", "1493307710"], ["created_at", "2017-04-26 15:41:50.641220"], ["updated_at", "2017-04-26 15:41:50.641220"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.1ms) ROLLBACK  (0.0ms) BEGIN Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["synced_id", 123], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh_token"], ["oauth_expires_at", "1493134910"], ["created_at", "2017-04-26 15:41:50.644766"], ["updated_at", "2017-04-26 15:41:50.644766"]]  (0.3ms) COMMIT  (0.1ms) BEGIN  (0.0ms) BEGIN Account Exists (0.6ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" = 123 AND "accounts"."id" != 5) LIMIT 1 SQL (0.2ms) UPDATE "accounts" SET "oauth_access_token" = $1, "oauth_refresh_token" = $2, "oauth_expires_at" = $3, "updated_at" = $4 WHERE "accounts"."id" = $5 [["oauth_access_token", "refreshed_token"], ["oauth_refresh_token", "refreshed_refresh_token"], ["oauth_expires_at", "1493394110"], ["updated_at", "2017-04-26 15:41:50.665555"], ["id", 5]]  (0.4ms) COMMIT  (0.1ms) ROLLBACK Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1 [["id", 5]] Account Load (0.1ms) SELECT "accounts".* FROM "accounts"  (0.0ms) BEGIN SQL (0.1ms) DELETE FROM "accounts" WHERE "accounts"."id" = $1 [["id", 5]]  (0.3ms) COMMIT  (0.8ms) BEGIN Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.2ms) INSERT INTO "accounts" ("synced_id", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["synced_id", 123], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh_token"], ["oauth_expires_at", "1493134910"], ["created_at", "2017-04-26 15:41:50.674111"], ["updated_at", "2017-04-26 15:41:50.674111"]]  (0.3ms) COMMIT  (0.1ms) BEGIN Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" = 123 AND "accounts"."id" != 6) LIMIT 1 SQL (0.1ms) UPDATE "accounts" SET "oauth_access_token" = $1, "oauth_refresh_token" = $2, "oauth_expires_at" = $3, "updated_at" = $4 WHERE "accounts"."id" = $5 [["oauth_access_token", "refreshed_token"], ["oauth_refresh_token", "refreshed_refresh_token"], ["oauth_expires_at", "1493394110"], ["updated_at", "2017-04-26 15:41:50.677690"], ["id", 6]]  (0.3ms) COMMIT Account Load (0.2ms) SELECT "accounts".* FROM "accounts"  (0.0ms) BEGIN SQL (0.1ms) DELETE FROM "accounts" WHERE "accounts"."id" = $1 [["id", 6]]  (0.2ms) COMMIT  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" IS NULL LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["oauth_access_token", "token"], ["oauth_refresh_token", "refresh"], ["oauth_expires_at", "expires"], ["created_at", "2017-04-26 15:41:50.682399"], ["updated_at", "2017-04-26 15:41:50.682399"]]  (0.1ms) RELEASE SAVEPOINT active_record_1  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" IS NULL AND "accounts"."id" != 7) LIMIT 1 SQL (0.1ms) UPDATE "accounts" SET "oauth_access_token" = $1, "oauth_refresh_token" = $2, "oauth_expires_at" = $3, "updated_at" = $4 WHERE "accounts"."id" = $5 [["oauth_access_token", nil], ["oauth_refresh_token", nil], ["oauth_expires_at", nil], ["updated_at", "2017-04-26 15:41:50.684651"], ["id", 7]]  (0.1ms) RELEASE SAVEPOINT active_record_1 Account Load (0.3ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1 [["id", 7]]  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:41:50.688553"], ["updated_at", "2017-04-26 15:41:50.688553"]]  (0.1ms) RELEASE SAVEPOINT active_record_1  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 123], ["created_at", "2017-04-26 15:41:50.690386"], ["updated_at", "2017-04-26 15:41:50.690386"]]  (0.1ms) RELEASE SAVEPOINT active_record_1 Account Load (0.2ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.5ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" = 123 AND "accounts"."id" != 9) LIMIT 1 SQL (0.2ms) UPDATE "accounts" SET "name" = $1, "oauth_access_token" = $2, "oauth_refresh_token" = $3, "oauth_expires_at" = $4, "updated_at" = $5 WHERE "accounts"."id" = $6 [["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["updated_at", "2017-04-26 15:41:50.693897"], ["id", 9]]  (0.1ms) RELEASE SAVEPOINT active_record_1  (0.1ms) ROLLBACK  (0.1ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:41:50.697394"], ["updated_at", "2017-04-26 15:41:50.697394"]]  (0.1ms) RELEASE SAVEPOINT active_record_1  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 123], ["created_at", "2017-04-26 15:41:50.699294"], ["updated_at", "2017-04-26 15:41:50.699294"]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" = 123 AND "accounts"."id" != 11) LIMIT 1 SQL (0.2ms) UPDATE "accounts" SET "name" = $1, "oauth_access_token" = $2, "oauth_refresh_token" = $3, "oauth_expires_at" = $4, "updated_at" = $5 WHERE "accounts"."id" = $6 [["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["updated_at", "2017-04-26 15:41:50.701687"], ["id", 11]]  (0.1ms) RELEASE SAVEPOINT active_record_1 Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1 [["id", 11]]  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.5ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:41:50.705088"], ["updated_at", "2017-04-26 15:41:50.705088"]]  (0.1ms) RELEASE SAVEPOINT active_record_1  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 123], ["created_at", "2017-04-26 15:41:50.707575"], ["updated_at", "2017-04-26 15:41:50.707575"]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Load (0.3ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE ("accounts"."synced_id" = 123 AND "accounts"."id" != 13) LIMIT 1 SQL (0.1ms) UPDATE "accounts" SET "name" = $1, "oauth_access_token" = $2, "oauth_refresh_token" = $3, "oauth_expires_at" = $4, "updated_at" = $5 WHERE "accounts"."id" = $6 [["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["updated_at", "2017-04-26 15:41:50.710236"], ["id", 13]]  (0.1ms) RELEASE SAVEPOINT active_record_1 Account Load (0.2ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."id" = $1 LIMIT 1 [["id", 13]]  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.2ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:41:50.713940"], ["updated_at", "2017-04-26 15:41:50.713940"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.2ms) SELECT COUNT(*) FROM "accounts" Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.4ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.2ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:41:50.719135"], ["updated_at", "2017-04-26 15:41:50.719135"]]  (0.1ms) RELEASE SAVEPOINT active_record_1  (0.1ms) SELECT COUNT(*) FROM "accounts"  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:41:50.722421"], ["updated_at", "2017-04-26 15:41:50.722421"]]  (0.5ms) RELEASE SAVEPOINT active_record_1 Account Load (0.2ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.1ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:41:50.725478"], ["updated_at", "2017-04-26 15:41:50.725478"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.1ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:41:50.728489"], ["updated_at", "2017-04-26 15:41:50.728489"]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:41:50.730739"], ["updated_at", "2017-04-26 15:41:50.730739"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.0ms) ROLLBACK  (0.0ms) BEGIN  (0.0ms) SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 456 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("provider", "synced_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["provider", "bookingsync"], ["synced_id", 456], ["created_at", "2017-04-26 15:41:50.733205"], ["updated_at", "2017-04-26 15:41:50.733205"]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Load (0.1ms) SELECT "accounts".* FROM "accounts" WHERE "accounts"."synced_id" = $1 AND "accounts"."provider" = $2 LIMIT 1 [["synced_id", 123], ["provider", "bookingsync"]]  (0.1ms) SAVEPOINT active_record_1 Account Exists (0.1ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 123 LIMIT 1 SQL (0.1ms) INSERT INTO "accounts" ("synced_id", "provider", "name", "oauth_access_token", "oauth_refresh_token", "oauth_expires_at", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["synced_id", 123], ["provider", "bookingsync"], ["name", "business name"], ["oauth_access_token", "token"], ["oauth_refresh_token", "refresh token"], ["oauth_expires_at", "expires at"], ["created_at", "2017-04-26 15:41:50.735450"], ["updated_at", "2017-04-26 15:41:50.735450"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.0ms) ROLLBACK  (0.0ms) BEGIN  (0.1ms) ROLLBACK  (0.0ms) BEGIN Account Load (0.4ms) SELECT "accounts".* FROM "accounts" ORDER BY "accounts"."id" ASC LIMIT 1  (0.1ms) SAVEPOINT active_record_1 SQL (0.2ms) INSERT INTO "accounts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2017-04-26 15:41:50.771537"], ["updated_at", "2017-04-26 15:41:50.771537"]]  (0.0ms) RELEASE SAVEPOINT active_record_1  (0.0ms) SAVEPOINT active_record_1 SQL (0.2ms) UPDATE "accounts" SET "synced_id" = $1, "updated_at" = $2 WHERE "accounts"."id" = $3 [["synced_id", 0], ["updated_at", "2017-04-26 15:41:50.773121"], ["id", 22]]  (0.0ms) RELEASE SAVEPOINT active_record_1 Account Exists (0.2ms) SELECT 1 AS one FROM "accounts" WHERE "accounts"."synced_id" = 0 LIMIT 1  (0.1ms) ROLLBACK