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

Chase Lee
Chase Lee
29,275 Points

Rails can't seem to find the users section of my project.

Hi everyone!

I just added devise to my rails app and then tried to navigate to the /users section of my app, (which uses devise). Then it gave me this error.

The strange part about it, is that some parts of the /users section work and others don't.

This is what's in my routes file:

Stoabook::Application.routes.draw do
  devise_for :users
  resources :statuses
  root 'statuses#index'
end

Does anybody have any idea of what's going on?

Thank you so much!

-Chase

3 Answers

Neil Northrop
Neil Northrop
5,095 Points

Hey Chase,

I could be totally wrong about this, but it seems like your routes file does not have a path to your /users.

Your picture you uploaded doesn't have a GET verb to just /users. Again I could totally be wrong about this but I haven't played too much with Devise so I'm not too sure.

I suppose if you wanted to try something, maybe add the follow to your routes file:

get '/users', to: 'users#index' 

And make sure in your users_controller.rb file you have the following:

class User < ApplicationController
.
.
.
    def index
        @users = User.all
    end
.
.
.
end

Hopefully that isn't too far off. Maybe someone else could correct me if I'm wrong or give a little more advice.

Good luck!

Chase Lee
Chase Lee
29,275 Points

Hi Neil,

I've been reading around online and that seems to be the case.

Thank you so much for your time!

Neil Northrop
Neil Northrop
5,095 Points

Hey Chase,

I'm glad to hear that!

Happy coding!