$ git merge account-activation error: cannot stat 'app/views/user_mailer': Permission denied error: cannot stat 'app/views/user_mailer': Permission denied error: cannot stat 'app/views/user_mailer': Permission denied error: cannot stat 'app/views/user_mailer': Permission denied Updating a79ce83..323d78c ``````ここに言語を入力 ↓ new.html.erb <% provide(:title, 'Sign up') %> <% provide(:button_text, 'Create my account') %> <h1>Sign up</h1> <div class="row"> <div class="col-md-6 col-md-offset-3"> <%= render 'form' %> </div> </div> ↓ _form.html.erb <%= form_for(@user, url: yield(:url)) do |f| %> <%= render 'shared/error_messages', object: @user %> <%= f.label :name %> <%= f.text_field :name, class: 'form-control' %> <%= f.label :email %> <%= f.email_field :email, class: 'form-control' %> <%= f.label :password %> <%= f.password_field :password, class: 'form-control' %> <%= f.label :password_confirmation %> <%= f.password_field :password_confirmation, class: 'form-control' %> <%= f.submit yield(:button_text), class: "btn btn-primary" %> <% end %> ↓ contoroller class UsersController < ApplicationController before_action :logged_in_user, only: [:index, :edit, :update, :destroy] before_action :correct_user, only: [:edit, :update] before_action :admin_user, only: :destroy def index @users = User.where(activated: true).paginate(page: params[:page]) end def show @user = User.find(params[:id]) redirect_to root_url and return unless @user.activated? end def new @user = User.new end def create @user = User.new(user_params) if @user.save @user.send_activation_email #UserMailer.account_activation(@user).deliver_now flash[:info] = "Please check your email to activate your account." redirect_to root_url else render 'new' end end def edit end def update if @user.update_attributes(user_params) flash[:success] = "Profile updated" redirect_to @user else render 'edit' end end def destroy User.find(params[:id]).destroy flash[:success] = "User deleted" redirect_to users_url end private def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation) end #beforeアクション #ログイン済みユーザーかどうか確認 def logged_in_user unless logged_in? store_location flash[:danger] = "please log in." redirect_to login_url end end #正しいユーザーかどうか確認 def correct_user @user = User.find(params[:id]) redirect_to(root_url) unless current_user?(@user) end #管理者かどうか確認 def admin_user redirect_to(root_url) unless current_user.admin? end end ```### 前提・実現したいこと 現在、Railsチュートリアル第11章をやっているところなのですが、ユーザー有効化機能の実装を行ったところで、一旦、ホームのSign up now!から入って仮のユーザーを登録してCreate my accountをクリックするとエラーページが出てしまいます。 いろいろ探ってはみたのですが、記述ミスは無いように思うのですが、 「UsersController#create」にあるエラーが読み取れんなく困っております。 詳しい方居られましたら、アドバイス頂けますと有難いです。 よろしくお願いします。 ### 発生している問題・エラーメッセージ
ActionController::InvalidAuthenticityToken in UsersController#create
### 該当のソースコード
エラーページに出てきているコードです。
def handle_unverified_request
raise ActionController::InvalidAuthenticityToken
end
end
end
### 試したこと 諸々のサイトを確認したのですが、よく解らず何も出来ていない状況です。 ### 補足情報(FW/ツールのバージョンなど) ここにより詳細な情報を記載してください。
createを呼ぶviewを見せてください
winterboum様
ご連絡ありがとうございます。
createを呼ぶviewは、以下で良いでしょうか?まだあまりrailsのファイル相関が分かっておらず、間違っておりましたらご指摘ください。
よろしくお願いします。
<% provide(:title, 'Sign up') %>
<% provide(:button_text, 'Create my account') %>
<h1>Sign up</h1>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<%= render 'form' %>
</div>
</div>
render 'form' の方も。 _form.html.*ですね。
で、これらは 質問を編集してそちらに書いてください。<code>を使って頂くと読みやすくなりますので、そちらを。
あと、そのviewを書くcontrollerも欲しいです
winterboum様
更新しました。よろしくお願いします。
winterboum様
11章を再度記述しなおして、mergeしてみたのですが、user_mailerのみ撥ねられました。
何が原因なのか全く判らず、対処法ありましたらアドバイス頂けますと有難いです。