2013-10-30 111 views
0

我已經添加了設計行動的自定義路線。路線在耙路線但頁面說沒有路線匹配[GET]與設計

[email protected]:~/Documents/ronde$ rake routes 
     static_about GET  /static/about(.:format)    static#about 
     static_tour GET  /static/tour(.:format)     static#tour 
     static_home GET  /static/home(.:format)     static#home 
static_terms_of_use GET  /static/terms_of_use(.:format)   static#terms_of_use 
     static_contact GET  /static/contact(.:format)    static#contact 
     users_profile GET  /users/profile(.:format)    registrations#edit 
       login GET  /login(.:format)      devise/sessions#new 
       logout GET  /logout(.:format)      devise/sessions#destroy 
      register GET  /register(.:format)     devise/registrations#new 
     profile_edit GET  /profile/edit(.:format)    devise/registrations#edit 
    new_user_session GET  /users/sign_in(.:format)    devise/sessions#new 
     user_session POST  /users/sign_in(.:format)    devise/sessions#create 
destroy_user_session GET  /users/sign_out(.:format)    devise/sessions#destroy 
user_omniauth_authorize GET|POST /users/auth/:provider(.:format)  omniauth_callbacks#passthru {:provider=>/google|facebook/} 
user_omniauth_callback GET|POST /users/auth/:action/callback(.:format) omniauth_callbacks#(?-mix:google|facebook) 
     user_password POST  /users/password(.:format)    devise/passwords#create 
    new_user_password GET  /users/password/new(.:format)   devise/passwords#new 
    edit_user_password GET  /users/password/edit(.:format)   devise/passwords#edit 
        PUT  /users/password(.:format)    devise/passwords#update 
cancel_user_registration GET  /users/cancel(.:format)    devise/registrations#cancel 
    user_registration POST  /users(.:format)      devise/registrations#create 
new_user_registration GET  /users/sign_up(.:format)    devise/registrations#new 
edit_user_registration GET  /users/edit(.:format)     devise/registrations#edit 
        PUT  /users(.:format)      devise/registrations#update 
        DELETE /users(.:format)      devise/registrations#destroy 
       root  /         static#home 

這裏就是我用同樣添加了新的路線我的routes.rb文件:這個當我嘗試去/型材/編輯或/或登錄/註銷這裏是耙路線不工作對於色器件控制器操作:

Ronde::Application.routes.draw do 

get "static/about" 
get "static/tour" 
get "static/home" 
get "static/terms_of_use" 
get "static/contact" 
get "/user/profile", :to => 'registrations#edit' 
get "/login", :to => "devise/sessions#new" # Add a custom sign in route for user sign in 
get "/logout", :to => "devise/sessions#destroy" # Add a custom sing out route for user sign out 
get "/register", :to => "devise/registrations#new" # Add a Custom Route for Registrations 
get "profile/edit", :to => "devise/registrations#edit" 

devise_for :users, :controllers => { :omniauth_callbacks => "omniauth_callbacks" } 


root to: 'static#home' 
end 

# :path_names => {:edit => "profile/edit", :sign_in => "login", :sign_out => "logout",  :sign_up => "register" } 

然後頁說,應該給色器件控制器路線:

Routing Error 

No route matches [GET] "/profile/edit" 
Try running rake routes for more information on available routes. 
+0

這些路由似乎不匹配'rake routes'輸出...'/ profile/edit'沒有出現在您的routes.rb中。您還有三條路線來編輯用戶的個人資料? – sevenseacat

+0

它是正確的/註冊 – user2934734

+0

啊*現在*它是:P – sevenseacat

回答

0

我不知道這個正確的,但我認爲你不能做到這一點的方式,因爲Devise沒有任何控制器。請檢查這個questionthis

我平時做了什麼讓另一個控制器的設計,或正常控制器類似users_controller與它自己的意見。並註冊它routes.rb像:

devise_for :users 

scope "/admin" do 
    resources :users 
end 

然後,當我需要打開它,我叫localhost:3000/admin/users

但請糾正我,如果有什麼問題,或者我的方式做到這一點是錯誤的。希望可以幫助。