best_in_place没有保存

所以,我正在使用最好的gem,以允许用户编辑他们的照片标题。 但是,输入的文本未保存或存储在数据库中。

以下是与此区域相关的架构的快照:

create_table "photos", force: true do |t| t.string "file" t.integer "attachable_id" t.datetime "created_at" t.datetime "updated_at" t.string "attachable_type" t.string "title" t.text "description" t.boolean "profile_photo", default: false end 

这是视图代码:

  

我究竟做错了什么?

更新:

  

您没有在视图中使用best_in_place辅助方法。 查看README或Railscast#302 。

你必须做那样的事情:

 <%= best_in_place @photo, :description, type: :input %> 

根据您的需要进行调整。

仅供参考: text_field是Rails提供的辅助方法 。