0

それはおかしい。カスタムユーザー登録を作成していて、ユーザー作成後にOTHERページにリダイレクトしたいのですが、showactionを呼び出したいと思います。

これが私のコントローラーです:

def create
  @user = User.new(params[:user])

respond_to do |format|
  if @user.save
    format.html { redirect_to users_verify_path }
  else
    format.html { render action: "new" }

  end
end

end def verify ... end inroutes.rb:

       resources :users

       root :to => 'users#new'

        get "users/verify"

アクションの名前をSHOWに変更すると、すべてが機能しています。VERIFYという名前を付けると、次のように表示されます。

    Unknown action

    The action 'show' could not be found for UsersController

アクションショーを削除したので、明らかなエラーです。しかし、なぜそれが表示にリダイレクトされているのですか?

4

1 に答える 1

1

resources:usersの前にget "users/verify"と書いてみてください

また

resources :users do
  member do
    get 'verify'
  end
end
于 2012-08-30T11:07:07.630 に答える