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 Building Social Features in Ruby on Rails Building the Friendship UI Creating the Friendship

Lisa Rossiter
Lisa Rossiter
3,630 Points

Check the devise documentation - Could you not just explain it in the video?

Can someone explain why I had to do this it sais check the link but it is useless and does not explain why I had to make that change. He just skimmed over it very quickly...

as :user do
    get "/login" => 'devise/sessions#new', as: :new_user_session
    post "/login" => 'devise/sessions#new', as: :user_session
    delete "/logout" => 'devise/sessions#destroy', as: :destroy_user_session
  end

2 Answers

Essentially, you're just using "/login" instead of "sign_in" which is what devise comes with naturally. Compare that to "rake routes" and it'll make a little more sense

Lisa Rossiter
Lisa Rossiter
3,630 Points

I know however that was already done thats what confused me take a look at this.

get "profiles/show"


  as :user do
    get '/register', to: 'devise/registrations#new', as: :register
    get '/login', to: 'devise/sessions#new', as: :login
  end

  devise_for :users, skip: [:sessions]

  as :user do
    get "/login" => 'devise/sessions#new', as: :new_user_session
    post "/login" => 'devise/sessions#new', as: :user_session
    delete "/logout" => 'devise/sessions#destroy', as: :destroy_user_session
  end