我建了一个名为news的数据表,包含title、editors和content三个字段,然后我新建了一个news,我填写内容并提交,后台捕捉到了三个字段对应的内容,但是并没有存进数据库。
1.前端表单
2.这是news的控制器
3.捕获到但没存进数据库
4.数据库为空
拜托大家帮我看看为什么,谢谢!
认证0级讲师
There may be something wrong with the writing of create@new = New.new(params[:new])if @new.save!
.... ....
You didn’t assign a value
Try it @new = New.new(new_params)
@new = New.new(new_params)
Brother, you didn’t assign a value, use this New.create!(params)
There may be something wrong with the writing of create
@new = New.new(params[:new])
if @new.save!
You didn’t assign a value
Try it
@new = New.new(new_params)
Brother, you didn’t assign a value, use this New.create!(params)