Skip to content

Instantly share code, notes, and snippets.

@chrisyeung1121
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisyeung1121/e76176a5ff78e984a3a9 to your computer and use it in GitHub Desktop.
Save chrisyeung1121/e76176a5ff78e984a3a9 to your computer and use it in GitHub Desktop.
Scoping controllers in rails routes
as :user do
# Sessions
get '/login' => 'users/sessions#new', as: :new_user_session
# Registration
controller 'users/registrations' do
get '/signup', action: :new, as: :new_user_registration
end
end
# can also do sth like this:
match '/auth/:provider/callback', to: 'sessions#create', via: [:get, :post]
## the ways we write in #sessions and #registrations are inter-changeable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment