我的登录工作正常,但我不知道我搞砸了哪里。当我登录时,它会重定向会话/用户,这是错误的。这是错误:
No route matches [POST] "/sessions/user"
这是我的routes.rb:
Wal::Application.routes.draw do
resources :sessions, :only => [:new, :create, :destroy]
devise_for :users, :skip => [:sessions]
devise_for :users do get '/users/sign_out' => 'devise/sessions#destroy' end
resources :posts do
resources :comments
end
resources :users, :only => [:show]
resources :microsposts, :only => [:create, :destroy]
match '/' => "home#index", :as => :home
match 'home/index', :to => 'home#index'
get "users/show"
root :to => "home#index"
#get "home/index"
resources :users do
member do
get :following, :followers
end
end
resources :microsposts, :only => [:create, :destroy]
resources :relationships, :only => [:create, :destroy]
应用程序控制器:
class ApplicationController < ActionController::Base
protect_from_forgery
def after_sign_in_path_for(resource)
current_user # <- Path you want to redirect the user to after signup
end
def after_sign_up_path_for(resource)
current_user
end
答案 0 :(得分:1)
尝试这样的事情
class ApplicationController < ActionController::Base
def after_sign_in_path_for(resource)
stored_location_for(resource) || welcome_path
end
end
答案 1 :(得分:0)
不知道这是否能解决您的问题,但第一行:
Wal :: Application.routes.draw做
在您发布的代码中没有相应的“结束”。