我有Devise 3.5.6與正常的用戶模型。用戶關聯模型如user.user_profile如何在設計編輯表單中更新?
我創建了另一個型號爲user_profile
,關係爲user has_one user_profile
和user_profile belongs_to user
。
用戶配置包含:
create_table "user_profiles", force: :cascade do |t|
t.string "name"
t.string "city"
t.string "country"
t.text "about"
t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
現在我想的edit_user_registration_path
有此模型的形式,領域以及該模型被保存編輯後的形式更新。
該模型在創建用戶後自動創建空字段。
你可以使用'嵌套表格'來做這個 – Deep
你能解釋一下嗎? –