更新方法似乎不起作用,我收到以下错误:
x = input("What number would you want")
我有课程模型和课程模型,我可以使用课程模型的更新方法,但不能用于课程模型......
有什么建议吗?
答案 0 :(得分:2)
这对我有用,希望如果它保存在DB中也必须为你做好
def update
@lesson = Lesson.find(params[:id])
if @lesson.update(params)
redirect_to root_path, alert: "Your lesson is saved!"
else
render 'edit', alert: "Oops! There was a problem, please try again"
end
end