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!
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
Benjamin Botwin13,434 Points
Why separate the devise routes blocks?
Why would you write this
as :user do get '/register', to: 'devise/registrations#new', as: :register get '/login', to: 'devise/sessions#new', as: :login get '/logout', to: 'devise/sessions#destroy', as: :logout end devise_for :users, skip: [:sessions] as :user do get "/login" => 'devise/sessions#new', as: :new_user_session post "/login" => 'devise/sessions#create', as: :user_session delete "/logout" => 'devise/sessions#destroy', as: :destroy_user_session end
Why not put all of it in one as :user do block and put devise_for :user... before it all?
EDIT: I can't seem to get the formatting right. Sorry.
Jason SeiferTreehouse Guest Teacher
Hey Benjamin Botwin you can definitely do that. We did it in two parts to make the videos a little easier to follow along with. Great question!