我严重无法解决这个语法错误:
PG::Error: ERROR: syntax error at or near "07"
LINE 1: ...WHERE (post_id = 13 AND created_at > 2012-08-27 07:13:26) ...
这是我的查询的样子:
Post.where(post_filter_params_where)
def post_filter_params_where
case params[:post_filter].to_i
when 1
"post_id = #{params[:id]}"
when 2
"post_id = #{params[:id]}"
when 3
time = 24.hours.ago.utc.to_s(:db)
"post_id = #{params[:id]} AND created_at > #{time}"
else
"post_id = #{params[:id]}"
end
end