Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

Ethan Moffat
Ethan Moffat
184 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

The error:

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.