我已經升級我的項目到Rails 4,但MySQL是有錯誤:軌道4:MySQL的2錯誤
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 '=> nil OR delete_by < 1)) ORDER BY
t_dest_boards .
ID ASC LIMIT 1' at line 1: SELECT
t_dest_boards .* FROM
t_dest_boards WHERE (m_section_id = 1 AND v_employee_id = '02001' AND registration_date = '2017-02-13' AND (delete_by => nil OR delete_by < 1)) ORDER BY
t_dest_boards .
ID ASC LIMIT 1
在這行代碼:
tdest_tmp = TDestBoard.where("m_section_id = ? AND v_employee_id = ? AND registration_date = ? AND (delete_by => nil OR delete_by < ?)", primary_section.m_section_id, params[:id], params[:tdaily_dates]["#{id}"], 1).first
可能是什麼的正確方法在Rails 4中這樣做?提前致謝!
delete_by =>無delete_by <1'您可以仔細檢查這個條件的查詢和什麼是'nil'? –