Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
299 views
in Technique[技术] by (71.8m points)

为什么我新建的字段内容能捕获到,但存不进数据库?

我建了一个名为news的数据表,包含title、editors和content三个字段,然后我新建了一个news,我填写内容并提交,后台捕捉到了三个字段对应的内容,但是并没有存进数据库。

1.前端表单
clipboard.png

2.这是news的控制器
clipboard.png

3.捕获到但没存进数据库
clipboard.png

4.数据库为空
clipboard.png

拜托大家帮我看看为什么,谢谢!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

create 写的有问题的吧
@new = New.new(params[:new])
if @new.save!

....
....

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...