acts-as-taggable-array-on
acts-as-taggable-array-on copied to clipboard
cannot work with default scope
when use acts_as_paranoid
irb(main):001:0> Topic.all_tags
(2.8ms) SELECT tag FROM (SELECT DISTINCT unnest(topics.tags) as tag FROM "topics") subquery WHERE "topics"."deleted_at" IS NULL
Traceback (most recent call last):
1: from (irb):1
ActiveRecord::StatementInvalid (PG::UndefinedTable: ERROR: missing FROM-clause entry for table "topics")
LINE 1: ...topics.tags) as tag FROM "topics") subquery WHERE "topics"."...
^
: SELECT tag FROM (SELECT DISTINCT unnest(topics.tags) as tag FROM "topics") subquery WHERE "topics"."deleted_at" IS NULL
irb(main):002:0> Topic.unscoped.all_tags
(3.8ms) SELECT tag FROM (SELECT DISTINCT unnest(topics.tags) as tag FROM "topics") subquery
=> ["recommend", "adapter", "emojionearea", "hello", "emojione"]
irb(main):003:0>
Which gem version are you using?
I had a similar issue in my codebase and I fixed it here: https://github.com/tmiyamon/acts-as-taggable-array-on/commit/b23cad36ec31cccb80d17fc227fa54ec39006cb3
This should be working for 0.5.1 version.
@skatkov but, my gem version is 😢
acts-as-taggable-array-on (0.5.1)
Based on information you provided, I really have no clue what could be wrong here.