Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.