前提・実現したいこと
Deviceを利用したログイン機能を実装中に以下のエラーメッセージが発生しました。
発生している問題・エラーメッセージ
NameError in Devise::Confirmations#new Showing /home/vagrant/rails/myapp/app/views/devise/confirmations/new.html.erb where line #8 raised: undefined local variable or method `unconfirmed_email' for #<User id: nil, email: "", created_at: nil, updated_at: nil>
該当のソースコード
erb
1<h2>Resend confirmation instructions</h2> 2 3<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> 4<%= devise_error_messages! %> 5 6 <div class="form-group"> 7 <%= f.label :email %> 8 <%= f.email_field :email, autofocus: true, autocomplete: 'email', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: 'form-control' %> 9 </div> 10 11 <div class="form-group"> 12 <%= f.submit t('.resend_confirmation_instructions'), class: 'btn btn-primary' %> 13 </div> 14<% end %> 15 16<%= render 'devise/shared/links' %>
補足情報(FW/ツールのバージョンなど)
windows 10
vagrant 2.1.2
CentOS 6.8
ruby 2.5.1
rails 5.2.1
DeviceではなくDeviseです。質問タイトルも簡潔すぎるので、何を使っていて、エラーメッセージを書いたほうがいいでしょう。(undefined local variable or method `unconfirmed_email' の部分ですね。)
あなたの回答
tips
プレビュー