html - SQLite3::SQLException:在“at”附近:语法错误
问题描述
尝试遍历我拥有的作业时,我不断收到此错误,这是代码:
- @jobs.each do |job|
%h2= job.title
%p= job.company
这个异常:“SQLite3::SQLException:靠近“at”:语法错误”它没有识别行开头的“-”。我的文件是一个 .html.haml 文件。
这是作业控制器:
class JobsController < ApplicationController
before_action :find_job, only: [:show, :edit , :update , :destroy]
def index
@jobs=Job.all.order("created at DESC")
end
def show
end
def new
@job=Job.new
end
def create
@job=Job.new[job_params]
if(@job.save)
redirect_to @job
else
render "New"
end
end
def edit
end
def update
end
def destroy
end
def job_params
params.require(:job).permit(:title , :description , :company , :url)
end
def find_job
@job=Job.find(params[:id])
end
end
还有application_job
class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked
# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
end
解决方案
您的订单查询有错字:order("created at DESC")
应该是order("created_at DESC")
推荐阅读
- python - 两个多进程之间的实时通信
- typescript - 如何定义一个类型并确保它是打字稿中另一种类型的一部分?
- r - 在R中将列转换为行并重新排列表格
- javascript - 为什么我不能从它的根目录访问所有 WAR 包文件?
- asp.net-core - Postman 无法访问受 AAD 保护的 Asp.net core 3.1 restapi。401未经授权
- c# - 如何将异常从业务层引导到 UI 层
- mysql - 当我尝试从 docker-compose docker-compose 我的 .sql 文件时出错
- c++ - 宁静书商项目
- c - 为什么我在终端中看不到完整的 Linux 内核崩溃,但可以通过 COM 端口看到?
- c# - JanusGraph .net C#