开发者

acts-as-taggable-on won't show tag name

开发者 https://www.devze.com 2023-03-04 06:34 出处:网络
i don\'t know if this happens with you guys but when the column \'tagger_id\' and tagger_type are both filled out meaning all the columns are filled out in the taggings table, when you do this:

i don't know if this happens with you guys but when the column 'tagger_id' and tagger_type are both filled out meaning all the columns are filled out in the taggings table, when you do this:

record.category_list where record has acts_as_taggable_on :category

it prints out empty.

Remove the tagger_id and the tagger_type it will print the category_list find.

Note that doing this:

record.taggings results in rows so i don't undrsta开发者_如何转开发nd why it prints out empty.

Also,

record.categories_from(account) results in undefined method. in the README it says that doing @some_path.locations_from but it seems that function deos not exist and true enough i search for "_from" in the code did not find any.


If you look at the generated SQL, record.category_list will only look for taggings where the tagger_id is NULL. That is its default behavior, since it is designed to look for tags by a particular tagger.

If you are interested in all categories, without regard to tagger, you want record.all_categories_list.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号