【问题标题】:Rails ids returning more recordsRails ids 返回更多记录
【发布时间】:2021-09-28 20:23:03
【问题描述】:

不知道有没有人遇到过这个问题:

当我执行Question.count 时,它返回3112,但是当我运行Question.ids.count 时,结果是9685。

我的数据库坏了吗?

【问题讨论】:

    标签: ruby-on-rails postgresql ids


    【解决方案1】:

    好吧,当您在查询中包含子项时,结果似乎也会出现这些 id。我有default_scope { includes(:choices) },我删除了它,一切正常。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-01
    • 1970-01-01
    • 2018-12-22
    • 1970-01-01
    • 2016-04-22
    • 2013-12-04
    • 1970-01-01
    相关资源
    最近更新 更多