Mysql2::Error: 您的 SQL 语法有错误

发布于 2025-01-08 10:30:39 字数 677 浏览 2 评论 0原文

我刚刚使用这个来切换我的rails app db 从 sqlite3 到 mysql2 ,这似乎工作正常。

但是当我启动我的应用程序时,我现在得到了这样的信息:

A ActionView::Template::Error occurred in pages#dashboard:

Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '== 1) LIMIT 20 OFFSET 0' at line 1: SELECT `tickets`.* FROM `tickets` WHERE (archived == 1) LIMIT 20 OFFSET 0
activerecord (3.0.3) lib/active_record/connection_adapters/abstract_adapter.rb:202:in `log'

不确定在哪里可以使其正常工作。任何帮助将不胜感激。谢谢!

I just used this to switch my rails app db from sqlite3 to mysql2 and that seemed to work out properly.

But when I start up my app I'm now getting this:

A ActionView::Template::Error occurred in pages#dashboard:

Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '== 1) LIMIT 20 OFFSET 0' at line 1: SELECT `tickets`.* FROM `tickets` WHERE (archived == 1) LIMIT 20 OFFSET 0
activerecord (3.0.3) lib/active_record/connection_adapters/abstract_adapter.rb:202:in `log'

Not sure where to look to get this working properly. Any help would be appreciated. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ヅ她的身影、若隐若现 2025-01-15 10:30:40

试试这个:

# Notice single = vs ==
WHERE (archived = 1)

更新
最终做到了

scope :is_archived, where('archived != ?', 1)
scope :not_archived, where('archived = ?', 1)

这效果很好。谢谢!

Try this:

# Notice single = vs ==
WHERE (archived = 1)

Update
Ended up doing

scope :is_archived, where('archived != ?', 1)
scope :not_archived, where('archived = ?', 1)

This worked great. Thanks!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文