1
ユーザーアカウントを組み込みのデバイス確認コントローラを使用せずに確認しようとしていますが、次のエラー "初期化されていない定数確認コントローラ"以下は私の確認コントローラクラスです。初期化されていない定数ConfirmationsControllerのエラーがデバイスの確認コントローラを上書きしようとしています
class ConfirmationsController < Devise::ConfirmationsController
def show
@user = User.find_by_confirmation_token(params[:confirmation_token])
if [email protected]?
render_with_scope :new
end
end
def confirm_account
@user = User.find(params[:user][:confirmation_token])
if @user.update_attributes(params[:user]) and @user.has_password?
@user = User.confirm_by_token(@user.confirmation_token)
flash[:notice] = "Hi " + @user.first_name + " your email has been verified. You can now start shopping and recommending other users to your supplier networks."
redirect_to @user
else
render :action => "show"
end
end
end
そして、私のroutes.rbをファイルに私は、次のしている:
devise_for :users, :controllers => { :confirmations => "confirmations" } do
match "confirm_account", :to => "confirmations#confirm_account"
end
そして最後に、私は部分的に、次のしている:
<p>Welcome <%= @user.first_name %>,</p><br/>
<%= form_for(resource, :url => confirm_account_path) do |f| %>
<%= f.label :email %>
<%= @user.email %>
<%= f.hidden_field :confirmation_token %>
<%= f.submit 'Confirm Account' %>
<p>Thank you for joining. Before you can purchase any item from your supplier or shared network, you will need to confirm your account first. Please follow the link below in order to confirm your account.</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p><br/>
<p>Yours faithfully.</p>
<%end%>
リンクありがとうございます。ちょうど私が "confirmations_controller"ではなく "ConfirmationsController"としてコントローラクラスを保存したことに気付きました。これを変更してリンクをたどり、出てくるものを見てみましょう。 –