Tim*_*eym 3 routing ruby-on-rails confirmation devise devise-confirmable
无法通过设计确认电子邮件.
route.rb
devise_for :users, :controllers => { :sessions => "users/sessions" ,:omniauth_callbacks => "users/omniauth_callbacks" } do
post "users/confirmation", :to => "devise/confirmations#create"
get "users/confirmation/new", :to => "devise/confirmations#new", :as => "new_confirmation"
get "users/confirmation", :to => "devise/confirmations#show"
end
resources :pensioners #, :only => [:index, :destroy, :new]
resources :users #, :only => [:index, :destroy, :new]
Run Code Online (Sandbox Code Playgroud)
heroku运行rake路线
....
user_confirmation POST /users/confirmation(.:format) devise/confirmations#create
new_user_confirmation GET /users/confirmation/new(.:format) devise/confirmations#new
GET /users/confirmation(.:format) devise/confirmations#show
....
Run Code Online (Sandbox Code Playgroud)
但是当我提出要求时
GET /users/confirmation?confirmation_token=BeELxDDq9sxpseLh8Rdn
Run Code Online (Sandbox Code Playgroud)
我收到404 错误
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
Run Code Online (Sandbox Code Playgroud)
我哪里错了?
型号:
class User < ActiveRecord::Base
devise .... , :confirmable
Run Code Online (Sandbox Code Playgroud)
迁移:
class AddConfirmableToUsers < ActiveRecord::Migration
def up
add_column :users, :confirmation_token, :string
add_column :users, :confirmed_at, :datetime
add_column :users, :confirmation_sent_at, :datetime
add_index :users, :confirmation_token, :unique => true
User.update_all(:confirmed_at => Time.now)
end
....
Run Code Online (Sandbox Code Playgroud)
有点迟到,但无论如何.尝试使用PATCH而不是GET.你routes.rb应该有一条路线
patch '/user/confirmation' => 'user/confirmations#update', :via => :patch, :as => :update_user_confirmation
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2543 次 |
| 最近记录: |