Skip to content

Instantly share code, notes, and snippets.

@rjocoleman
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjocoleman/b21a9d0f408c3c66621e to your computer and use it in GitHub Desktop.
Save rjocoleman/b21a9d0f408c3c66621e to your computer and use it in GitHub Desktop.
create_or_update
Started POST "//api/factory-brand/subscribers" for 127.0.0.1 at 2014-05-27 12:23:09 +1200
Processing by API::SubscribersController#create_or_update as JSON
Parameters: {"subscriber"=>{"email"=>"a@monitorgd.com", "subscribe"=>1}, "brand_id"=>"factory-brand"}
Can't verify CSRF token authenticity
User Load (0.6ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 2]]
Brand Load (0.6ms) SELECT "brands".* FROM "brands" WHERE "brands"."slug" = 'factory-brand' ORDER BY "brands"."id" ASC LIMIT 1
SubscriberList Load (0.3ms) SELECT "subscriber_lists".* FROM "subscriber_lists" WHERE "subscriber_lists"."brand_id" = $1 AND "subscriber_lists"."archived" = 'f' AND "subscriber_lists"."id" = $2 LIMIT 1 [["brand_id", 1], ["id", 1]]
(0.3ms) BEGIN
Subscription Exists (10.5ms) SELECT 1 AS one FROM "subscriptions" WHERE ("subscriptions"."subscriber_list_id" = 1 AND "subscriptions"."subscriber_id" IS NULL) LIMIT 1
Subscriber Exists (0.5ms) SELECT 1 AS one FROM "subscribers" WHERE ("subscribers"."primary_email" = 'a@monitorgd.com' AND "subscribers"."brand_id" = 1) LIMIT 1
SQL (136.3ms) INSERT INTO "subscribers" ("brand_id", "created_at", "data", "primary_email", "token", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["brand_id", 1], ["created_at", "2014-05-27 00:23:09.419696"], ["data", "{\"extra_data\":{},\"channel_data\":{},\"adapter_feedback\":{}}"], ["primary_email", "a@monitorgd.com"], ["token", "83eb9e6390c345ab9d3049fae14a1fb2"], ["updated_at", "2014-05-27 00:23:09.419696"]]
SQL (39.1ms) INSERT INTO "subscriptions" ("created_at", "data", "subscriber_id", "subscriber_list_id", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["created_at", "2014-05-27 00:23:09.561290"], ["data", "{\"recipient_details\":{\"email\":\"a@monitorgd.com\"}}"], ["subscriber_id", 4], ["subscriber_list_id", 1], ["updated_at", "2014-05-27 00:23:09.561290"]]
SQL (0.5ms) UPDATE "subscriber_lists" SET "subscriptions_count" = COALESCE("subscriptions_count", 0) + 1 WHERE "subscriber_lists"."id" = 1
Subscription Exists (0.7ms) SELECT 1 AS one FROM "subscriptions" WHERE ("subscriptions"."subscriber_list_id" = 1 AND "subscriptions"."id" != 1 AND "subscriptions"."subscriber_id" = 4) LIMIT 1
SQL (0.3ms) UPDATE "subscriptions" SET "data" = $1, "updated_at" = $2 WHERE "subscriptions"."id" = 1 [["data", "{\"recipient_details\":{\"email\":\"a@monitorgd.com\"}}"], ["updated_at", "2014-05-27 00:23:09.609075"]]
(16.5ms) COMMIT
Rendered api/subscribers/create_or_update.json.jbuilder (9.1ms)
Completed 200 OK in 309ms (Views: 15.5ms | ActiveRecord: 207.1ms)
127.0.0.1 - - [27/May/2014 12:23:09] "POST /api/factory-brand/subscribers HTTP/1.1" 200 - 0.3435
Started POST "//api/factory-brand/subscribers" for 127.0.0.1 at 2014-05-27 12:25:21 +1200
Processing by API::SubscribersController#create_or_update as JSON
Parameters: {"subscriber"=>{"email"=>"a@monitorgd.com", "subscribe"=>1, "confirmed"=>true}, "brand_id"=>"factory-brand"}
Can't verify CSRF token authenticity
User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", 2]]
Brand Load (0.3ms) SELECT "brands".* FROM "brands" WHERE "brands"."slug" = 'factory-brand' ORDER BY "brands"."id" ASC LIMIT 1
SubscriberList Load (0.3ms) SELECT "subscriber_lists".* FROM "subscriber_lists" WHERE "subscriber_lists"."brand_id" = $1 AND "subscriber_lists"."archived" = 'f' AND "subscriber_lists"."id" = $2 LIMIT 1 [["brand_id", 1], ["id", 1]]
(0.1ms) BEGIN
Subscription Exists (0.4ms) SELECT 1 AS one FROM "subscriptions" WHERE ("subscriptions"."subscriber_list_id" = 1 AND "subscriptions"."subscriber_id" IS NULL) LIMIT 1
Subscriber Exists (0.4ms) SELECT 1 AS one FROM "subscribers" WHERE ("subscribers"."primary_email" = 'a@monitorgd.com' AND "subscribers"."brand_id" = 1) LIMIT 1
(0.2ms) ROLLBACK
Completed 422 Unprocessable Entity in 18ms (Views: 0.2ms | ActiveRecord: 2.4ms)
127.0.0.1 - - [27/May/2014 12:25:21] "POST /api/factory-brand/subscribers HTTP/1.1" 422 - 0.0528
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment