【问题标题】:Rails Ambiguous Where Clause Error in scopeRails Ambiguous Where 子句范围内的错误
【发布时间】:2015-11-07 13:49:38
【问题描述】:
default_scope {where("valid = ? AND active = ? AND mrp > ?", false, true, 0)}  

我在 where 子句中得到 Column 'mrp' is ambiguous 错误

我如何使它不那么模棱两可。我用 product.mrp 试过了

【问题讨论】:

    标签: sql ruby-on-rails ruby activerecord


    【解决方案1】:

    试试这个: default_scope {where("your_table_name.valid = ? AND your_table_name.active = ? AND your_table_name.mrp > ?", false, true, 0)}

    【讨论】:

    • 你救了我的命,因为我不明白 Ambiguous Where 的含义。
    猜你喜欢
    • 2018-10-11
    • 2017-11-03
    • 1970-01-01
    • 1970-01-01
    • 2019-07-15
    • 2017-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多