設定ページのチェックボックスを使用してプロフィールの設定を更新しようとしています。チェックボックスをクリックすると、設定ページにリダイレクトしたいので、コントローラに新しいアクションを追加してプロファイルを更新しますが、設定にリダイレクトします。Form_forエラー - 投稿に一致する経路がありません
<%= form_tag({:action => "edit_settings", :controller => "profiles"}, :html => {:multipart => true }) do |f| %>
私profiles
コントローラでマイedit_settings
アクション:私のroutes.rb
ファイル内
def edit_settings
@profile = user.profile
if @profile.update_attributes(params[:profile])
redirect_to settings_path, :notice => 'Updated user information successfully.'
else
render :edit
end
end
:
`No route matches {:action=>"edit_settings", :controller=>"profiles"}`
はここに私のform_for
コードです:しかし、私は次のエラーを取得しています
resources :profiles do
post :edit_settings
end
rake routes
内部:
profile_edit_settings POST /profiles/:profile_id/edit_settings(.:format) {:action=>"edit_settings", :controller=>"profiles"}
すばらしい説明、ありがとう! 'match" profiles/edit_settings "、:to =" profiles#edit_settings "を自分のルートファイルに追加しました。 – tvalent2