form_forを利用して、編集された情報をアップデートしたいと考えています。
- provide(:title, @user.nickname) .jumbotron3.jumbotron-extend .jumbotron-container .row .profile-cover-image = form_for(@user, html: { method: :put }) do |f| - if @user.profile_cover_image? = image_tag @user.profile_cover_image.url - else = image_tag("/images/icon/no-image.png") = f.file_field :profile_cover_image %aside.col-md-4 .profile-image %h3.user-nickname= @user.nickname .self-introduction %section.stats.grid-cell = render 'shared/stats' = link_to 'キャンセル', user_path(current_user), class: 'btn btn-primary', :id => "button7" = f.submit '変更を保存', user_path(current_user), class: 'btn btn-primary', :id => "button8"
現在、このようなコードを書いているのですが、最後の下記行にてタイトルのエラーが発生しています。
= f.submit '変更を保存', user_path(current_user), class: 'btn btn-primary', :id => "button8"
おそらく、その前のコードである
= link_to 'キャンセル', user_path(current_user), class: 'btn btn-primary', :id => "button7"
が悪さをして、「f」が使用できなくなっていると思うのですが、解決方法がわかりません。
もし、お分かりになれば教えて頂ければと思います。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/08/16 00:00