Ruby on rails 最好的地方不保存
因此,我正在使用最佳就地gem允许用户就地编辑他们的照片标题。但是,输入的文本未保存或存储在数据库中 以下是与此区域相关的架构快照:Ruby on rails 最好的地方不保存,ruby-on-rails,ruby,Ruby On Rails,Ruby,因此,我正在使用最佳就地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_typ
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
下面是查看代码:
<p class="summary-info"><%= text_field photo, :description, placeholder: 'Add a description...' %></p>
我做错了什么
更新:
<p class="summary-info"><%= best_in_place photo, :description, type: :textarea, nil: 'Enter a Caption' %></p>
您没有在视图中使用最佳位置
辅助方法。查看或
你必须这样做:
<%= best_in_place @photo, :description, type: :input %>
根据你的需要调整它
仅供参考:
text\u字段
是一个。我研究了它,我认为text\u字段是文本字段最佳位置gem的助手方法?我是否将最佳就地辅助方法与文本字段辅助方法一起添加?谢谢