我有一个用户模型,但我需要创建一个表单来仅更新一个属性。
编辑:我create_mailbox
在资源中添加了补丁,:users
但表单抛出了undefined method
settings_create_mailbox_path'` 错误。谁能给我一些关于这个成员补丁/资源路由如何工作的见解?
这是表格:
<%= form_for @user, url: settings_create_mailbox_path(@user) do |f| %>
<%= f.text_field :rss_mailbox, autocomplete: 'off'%>
<button type="submit" class="button">Create Mailbox</button>
<% end %>
这是用户路线:
resources :users, id: /.*/ do
member do
patch :settings_update, controller: :settings
patch :create_mailbox, controller: :settings
patch :view_settings_update, controller: :settings
patch :sharing_services_update, controller: :sharing_services
patch :actions_update, controller: :actions
end
end
这是设置路线:
get :settings, to: 'settings#settings'
namespace :settings do
get :account
get :billing
get :import_export
get :feeds
get :help
post :update_credit_card
post :mark_favicon_complete
post :update_plan
post :font
post :font_increase
post :font_decrease
post :entry_width
end