我收到错误消息“:没有路线匹配 [POST]”/subjects/create”
我已将“创建操作”指向“列表”,但列表工作正常,但我无法将新数据发布到我的数据库中。任何人都可以为我指明正确的方向。
Controller:
class SubjectsController < ApplicationController
def index
list
render('list')
end
def list
@subjects = Subject.order(:all)
end
def show
@subject = Subject.find(params[:id])
end
def new
@subject = Subject.new
end
def create
@subject = Subject.new(params[:subject])
if @subject.save
redirect_to(:action = 'list')
else
# If save fails, redisplay the form so user can fix problems
render('new')
end
end
end