【发布时间】:2015-11-28 03:21:15
【问题描述】:
我想在表 users 中找到一个用户,ID 如下:
<%= @user = User.find_by_sql("SELECT users . * FROM users WHERE id = [:id] ")%>
但我有一个例外:
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 '[:id]' at line 1: SELECT users . * FROM users WHERE id = [:id]
【问题讨论】:
-
可能你在语法中放错了“”
标签: mysql sql ruby-on-rails ruby-on-rails-4 ruby-on-rails-4.2