Skip to content

cannot work with default scope #25

@huobazi

Description

@huobazi

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions