mbleigh/acts-as-taggable-on — Issue #201: acts-as-taggable-on and to_json bug
Author: kirs
Created: 2011-11-15 08:26:45+00:00
State: open

ruby-1.8.7-p352 :027 > a=Post.last
Post Load (0.6ms) SELECT "posts".* FROM "posts" ORDER BY "posts"."id" DESC LIMIT 1
=> #
ruby-1.8.7-p352 :028 > a.tag_list
ActsAsTaggableOn::Tag Load (0.8ms) SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 198 AND "taggings"."taggable_type" = 'Post' AND (taggings.context = 'tags' AND taggings.tagger_id IS NULL)
=> ["foo", "bar"]
ruby-1.8.7-p352 :029 > a.to_json
=> "{\"to_main\":false,\"preview_images_count\":null,\"created_at\":\"2011-11-11T19:07:47+04:00\",\"title\":\"fdsf\",\"origin_url\":null,\"body\":\"232\",\"updated_at\":\"2011-11-11T19:08:06+04:00\",\"published\":true,\"imported_at\":null,\"trash\":false,\"search_body\":\"232\",\"id\":198,\"user_id\":2,\"trash_at\":null,\"rating_value\":0,\"published_at\":\"2011-11-11T19:08:04+04:00\",\"preview\":\"232\",\"community_id\":null,\"comments_count\":0,\"last_comment_created_at\":null}"

I need to serialize my model for Backbone, but tags doesn't exist then I call `@model.to_json`