strftime error while switching my database from sqlite3 to mysql in Rails4

后端 未结 2 554
长情又很酷
长情又很酷 2020-12-07 06:11

Recently i changed my database from sqlite3 to mysql.When i ran my project i am getting this error in one of the file which is using this query.

date = Date.today +

2条回答
  •  悲哀的现实
    2020-12-07 06:19

    Try this with simply replace,

    <% @employees = Employee.where("status = ? AND strftime('%d/%m', date_of_birth) = ?", "Active" , date.strftime('%d/%m')) %>
    

    With

    <% @employees = Employee.where("status = ? AND DATE_FORMAT(date_of_birth,'%d/%m') = ?", "Active" , date.strftime('%d/%m')) %>
    

提交回复
热议问题