0
我對Rails和Devise很新穎。我在登錄/註冊時遇到問題。當試圖簽到,我得到以下錯誤:登錄Rails 4,Devise和CanCan的問題
ActiveRecord::RecordNotFound in UsersController#show
Couldn't find User with 'id'=sign_in
在用戶控制器的show動作如下:
def show
authorize! :show, current_user
render 'profile_page'
end
任何幫助將不勝感激。
這裏是我的route.rb: Rails.application.routes.draw做
get 'users/:id' => 'users#show'
resources :users
get 'users/edit'
controller :static_pages do
get :home
get 'show' =>'users/show'
end
resources :posts do
resources :comments
end
scope '(:locale)' do
resources :posts
end
devise_for :users do
get '/users/sign_out' => 'devise/sessions#destroy', :as => :destroy_user_session
get 'users/:id' => 'users#show'
end
authenticated :user do
root :to => 'posts#index', as: :authenticated_root
end
resources :contacts, only: [:new, :create] do
root :to => 'static_pages#home'
end
controller :static_pages do
get :home
get 'about' =>'static_pages#about'
get 'about_class' => 'static_pages#about_class'
get 'schedule_class' =>'static_pages#schedule_class'
end
end
我不確定我是否理解。我嘗試了各種各樣的東西。你能再看看我已經添加了路線並詳細說明你的答案或給我另一個指針嗎?再次,任何進一步的信息或幫助將不勝感激。 –