Tag ownership and STI #224

Merged
merged 18 commits into from Jul 10, 2012

Conversation

Projects
None yet
3 participants
Contributor

unindented commented Jan 26, 2012

Tag ownership was failing when the owner was a subclass.

It inserted the tagging correctly, using the base class of the owner:

INSERT INTO "taggings" ("context", "created_at", "tag_id", "taggable_id", "taggable_type", "tagger_id", "tagger_type") VALUES (?, ?, ?, ?, ?, ?, ?)�[0m  [["context", "tags"], ["created_at", 2012-01-25 15:33:52 UTC], ["tag_id", 274], ["taggable_id", 131], ["taggable_type", "TaggableModel"], ["tagger_id", 25], ["tagger_type", "TaggableUser"]]

But then it queried incorrectly, using the class of the owner instead of the base class:

SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 131 AND "taggings"."taggable_type" = 'TaggableModel' AND (taggings.context = 'tags' AND taggings.tagger_id = 25 AND taggings.tagger_type = 'InheritingTaggableUser')
Collaborator

artemk commented Jul 9, 2012

can you rebase against master?

Contributor

unindented commented Jul 10, 2012

Ok, I think it's ready.

artemk merged commit 320748a into mbleigh:master Jul 10, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment