3

廣東話確認電子郵件,用色器件。設計/用戶/確認路線

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] 

Heroku的運行路線耙

               .... 
    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 

                   .... 

但是,當我做要求

GET /users/confirmation?confirmation_token=BeELxDDq9sxpseLh8Rdn 

我得到404 錯誤

The page you were looking for doesn't exist. 
    You may have mistyped the address or the page may have moved. 

我在哪裏錯了的?

型號

class User < ActiveRecord::Base 
     devise .... , :confirmable 

遷移

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 
    .... 

回答

5

很晚了,但無論如何。嘗試使用PATCH而不是GET。您的routes.rb應該有一條路線,如

patch '/user/confirmation' => 'user/confirmations#update', :via => :patch, :as => :update_user_confirmation 
+0

嗨,你能告訴我這是怎麼做的?謝謝 –

+1

@issy很抱歉遲到的迴應。這是,如果你仍然需要它:'補丁「/用戶/確認」 =>「用戶名/確認#更新」,:通過=>:補丁:爲=>:update_user_confirmation' –

+0

謝謝!真的很感謝這一點。 –