我有這個意見中/職位/ index.html.erbRuby on Rails的:設計問題
<% if user_signed_in? %>
<%= link_to('Logout', destroy_user_session_path, :method => 'delete') %>
<% else %>
<%= link_to('Login', new_user_session_path) %>
<% end %>
類PostsController <的ApplicationController 的before_filter:的authenticate_user! ....
class UsersController < ApplicationController before_filter:authenticate_user! 結束
耙路線:
new_user_session GET /usuarios/login(.:format) {:action=>"new", :controller=>"devise/sessions"}
user_session POST /usuarios/login(.:format) {:action=>"create", :controller=>"devise/sessions"}
destroy_user_session DELETE /usuarios/logout(.:format) {:action=>"destroy", :controller=>"devise/sessions"}
user_password POST /usuarios/secret(.:format) {:action=>"create", :controller=>"devise/passwords"}
new_user_password GET /usuarios/secret/new(.:format) {:action=>"new", :controller=>"devise/passwords"}
edit_user_password GET /usuarios/secret/edit(.:format) {:action=>"edit", :controller=>"devise/passwords"}
PUT /usuarios/secret(.:format) {:action=>"update", :controller=>"devise/passwords"}
cancel_user_registration GET /usuarios/register/cancel(.:format) {:action=>"cancel", :controller=>"devise/registrations"}
user_registration POST /usuarios/register(.:format) {:action=>"create", :controller=>"devise/registrations"}
new_user_registration GET /usuarios/register/cmon_let_me_in(.:format) {:action=>"new", :controller=>"devise/registrations"}
edit_user_registration GET /usuarios/register/edit(.:format) {:action=>"edit", :controller=>"devise/registrations"}
PUT /usuarios/register(.:format) {:action=>"update", :controller=>"devise/registrations"}
DELETE /usuarios/register(.:format) {:action=>"destroy", :controller=>"devise/registrations"}
posts GET /posts(.:format) {:action=>"index", :controller=>"posts"}
POST /posts(.:format) {:action=>"create", :controller=>"posts"}
new_post GET /posts/new(.:format) {:action=>"new", :controller=>"posts"}
edit_post GET /posts/:id/edit(.:format) {:action=>"edit", :controller=>"posts"}
post GET /posts/:id(.:format) {:action=>"show", :controller=>"posts"}
PUT /posts/:id(.:format) {:action=>"update", :controller=>"posts"}
DELETE /posts/:id(.:format) {:action=>"destroy", :controller=>"posts"}
/posts/:id/categ(.:format) {:controller=>"posts", :action=>"categ"}
/posts/:id/tag_posts(.:format) {:controller=>"posts", :action=>"tag_posts"}
posts_searcharchive /posts/searcharchive(.:format) {:controller=>"posts", :action=>"searcharchive"}
categories GET /categories(.:format) {:action=>"index", :controller=>"categories"}
POST /categories(.:format) {:action=>"create", :controller=>"categories"}
new_category GET /categories/new(.:format) {:action=>"new", :controller=>"categories"}
edit_category GET /categories/:id/edit(.:format) {:action=>"edit", :controller=>"categories"}
category GET /categories/:id(.:format) {:action=>"show", :controller=>"categories"}
PUT /categories/:id(.:format) {:action=>"update", :controller=>"categories"}
DELETE /categories/:id(.:format) {:action=>"destroy", :controller=>"categories"}
comments GET /comments(.:format) {:action=>"index", :controller=>"comments"}
POST /comments(.:format) {:action=>"create", :controller=>"comments"}
new_comment GET /comments/new(.:format) {:action=>"new", :controller=>"comments"}
edit_comment GET /comments/:id/edit(.:format) {:action=>"edit", :controller=>"comments"}
comment GET /comments/:id(.:format) {:action=>"show", :controller=>"comments"}
PUT /comments/:id(.:format) {:action=>"update", :controller=>"comments"}
DELETE /comments/:id(.:format) {:action=>"destroy", :controller=>"comments"}
countpages GET /countpages(.:format) {:action=>"index", :controller=>"countpages"}
POST /countpages(.:format) {:action=>"create", :controller=>"countpages"}
new_countpage GET /countpages/new(.:format) {:action=>"new", :controller=>"countpages"}
edit_countpage GET /countpages/:id/edit(.:format) {:action=>"edit", :controller=>"countpages"}
countpage GET /countpages/:id(.:format) {:action=>"show", :controller=>"countpages"}
PUT /countpages/:id(.:format) {:action=>"update", :controller=>"countpages"}
DELETE /countpages/:id(.:format) {:action=>"destroy", :controller=>"countpages"}
root /(.:format) {:controller=>"posts", :action=>"index"}
在routes.rb中:
devise_for :users, :path => "usuarios", :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock', :registration => 'register', :sign_up => 'cmon_let_me_in' }
我得到錯誤:
的ActionController :: RoutingError在#新設計/會話
顯示app/views/layouts/application.html.erb,其中行#16出現:
沒有路由匹配{:控制器=>「設計/職位」}
這是根:根:到=>「帖子#指數」,當我打http://0.0.0.0:3000,它重定向到http://0.0.0.0:3000/usuarios/login和得到這個錯誤,
應用程序/視圖/佈局/ application.html.erb:16:`_app_views_layouts_application_html_erb__647429696_90155120__982654953'
錯誤來自application.html.erb。你可以發佈該文件的內容嗎? – eugen
application.html.erb沒有問題,http://pastebin.com/Nka2j54e – railshero
我不知道爲什麼0%接受。如果答案的話,我會回答。 – railshero