Skip to content

Instantly share code, notes, and snippets.

@abrambailey
Created February 15, 2013 00:19
Show Gist options
  • Save abrambailey/4957623 to your computer and use it in GitHub Desktop.
Save abrambailey/4957623 to your computer and use it in GitHub Desktop.
1.9.3p286 :008 > @consumer = Consumer.first
Consumer Load (0.6ms) SELECT "consumers".* FROM "consumers" LIMIT 1
=> #<Consumer id: 25, hl: nil, created_at: "2012-10-22 19:14:34", updated_at: "2012-10-22 19:14:34", user_id: 29, display_name: nil, tagline: nil, desc: nil>
1.9.3p286 :009 > @consumer.interest_list = "yo, he"
ActsAsTaggableOn::Tag Load (0.8ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 25 AND "taggings"."taggable_type" = 'Consumer' AND (taggings.context = 'interests' AND taggings.tagger_id IS NULL)
=> "yo, he"
1.9.3p286 :010 > @consumer.interest_list
=> ["yo", "he"]
1.9.3p286 :011 > @consumer.save
(0.6ms) BEGIN
(1.0ms) UPDATE "consumers" SET "updated_at" = '2013-02-15 00:18:24.674171' WHERE "consumers"."id" = 25
ActsAsTaggableOn::Tag Load (10.8ms) SELECT "tags".* FROM "tags" WHERE (lower(name) = 'yo' OR lower(name) = 'he')
ActsAsTaggableOn::Tag Exists (0.8ms) SELECT 1 AS one FROM "tags" WHERE "tags"."name" = 'yo' LIMIT 1
SQL (32.5ms) INSERT INTO "tags" ("name") VALUES ($1) RETURNING "id" [["name", "yo"]]
ActsAsTaggableOn::Tag Exists (0.6ms) SELECT 1 AS one FROM "tags" WHERE "tags"."name" = 'he' LIMIT 1
SQL (0.6ms) INSERT INTO "tags" ("name") VALUES ($1) RETURNING "id" [["name", "he"]]
ActsAsTaggableOn::Tag Load (0.7ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 25 AND "taggings"."taggable_type" = 'Consumer' AND (taggings.context = 'interests' AND taggings.tagger_id IS NULL)
ActsAsTaggableOn::Tagging Exists (1.0ms) SELECT 1 AS one FROM "taggings" WHERE ("taggings"."tag_id" = 3 AND "taggings"."taggable_type" = 'Consumer' AND "taggings"."taggable_id" = 25 AND "taggings"."context" = 'interests' AND "taggings"."tagger_id" IS NULL AND "taggings"."tagger_type" IS NULL) LIMIT 1
SQL (39.4ms) INSERT INTO "taggings" ("context", "created_at", "tag_id", "taggable_id", "taggable_type", "tagger_id", "tagger_type") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["context", "interests"], ["created_at", Fri, 15 Feb 2013 00:18:25 UTC +00:00], ["tag_id", 3], ["taggable_id", 25], ["taggable_type", "Consumer"], ["tagger_id", nil], ["tagger_type", nil]]
ActsAsTaggableOn::Tagging Exists (0.7ms) SELECT 1 AS one FROM "taggings" WHERE ("taggings"."tag_id" = 4 AND "taggings"."taggable_type" = 'Consumer' AND "taggings"."taggable_id" = 25 AND "taggings"."context" = 'interests' AND "taggings"."tagger_id" IS NULL AND "taggings"."tagger_type" IS NULL) LIMIT 1
SQL (0.5ms) INSERT INTO "taggings" ("context", "created_at", "tag_id", "taggable_id", "taggable_type", "tagger_id", "tagger_type") VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING "id" [["context", "interests"], ["created_at", Fri, 15 Feb 2013 00:18:25 UTC +00:00], ["tag_id", 4], ["taggable_id", 25], ["taggable_type", "Consumer"], ["tagger_id", nil], ["tagger_type", nil]]
(10.6ms) COMMIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment