Welcome to the Treehouse Community
Looking to learn something new?
Ethan Moffat184 Points
RuntimeError in UsersController#show
I have been trying to fix this issue with Heroku for a while now. Whenever I try signing into my application via Devise my it will just throw up an error asking the application owner to check the logs. With that showing, I checked the logs & nothing was wrong. But I couldn't get to the authenticated part of my website.
So I tried changing ApplicationController to DeviseController
that just gives me an unknown action. Please tell me how I can just add show to the Devise controller.
Thank you for taking the time to help me, all answers will help me!
The controller code:
class UsersController < DeviseController def show @user = User.find(params[:id]) @user_posts = @user.posts end end
Unknown action Could not find devise mapping for path "/users/1". This may happen for two reasons: 1) You forgot to wrap your route inside the scope block. For example: devise_scope :user do get "/some/route" => "some_devise_controller" end 2) You are testing a Devise controller bypassing the router. If so, you can explicitly tell Devise which mapping to use: @request.env["devise.mapping"] = Devise.mappings[:user]
Also, perhaps someone can guide me threw doing this devise_scope thing. I am pretty to devise authentication & I don't quite understand. I am also fairly new to Rails.
If what I am thinking will fix my Heroku issue isn't anywhere near. Please tell me what I am doing wrong.