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

Routing Error No route matches [GET] "/robertborsey"

Can someone please help with this I'm getting this error ''' No route matches [GET] "/robertborsey" and then I put this code in routes.rb

 get '/:id', to: 'profiles#show'

  I get this

 The page you were looking for doesn't exist.

 You may have mistyped the address or the page may have moved.
 '''

can anybody tell me whats going on

thanks for the help

6 Answers

Brandon Barrette
Brandon Barrette
20,485 Points

In your model you need to change the to_param to use the profile_name as the id, so this should be in user.rb

def to_param
    profile_name
  end

Thanks for answering Brandon, Tried that and still didn't work. Any other thing I might have missed ?

Brandon Barrette
Brandon Barrette
20,485 Points

Then make sure there is a user with that profile name in your database. Make sure it hasn't been misspelled and that the profile name is there. That would be my last guess at what is wrong with the error information you've provided.

Do you mean in my users.yml file ?

Brandon Barrette
Brandon Barrette
20,485 Points

No. That file is for testing only. Go to your terminal, type rails console

Then type User.all

That will spit out all users. Make sure your user with that profile name is there.

Yes I'm in there.