Skip to content

Instantly share code, notes, and snippets.

@bensie
Last active August 29, 2015 14:18
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 bensie/49c9bc83599c40e06dfb to your computer and use it in GitHub Desktop.
Save bensie/49c9bc83599c40e06dfb to your computer and use it in GitHub Desktop.
Rails Authentication
Rails.application.routes.draw do
scope module: "api" do
constraints subdomain: "api" do
match "/", to: "root#options", via: [:options]
match "*unmatched", to: "root#options", via: [:options]
resource :me, only: [:show, :update], controller: "me"
post "/me/access_tokens", to: "access_tokens#create"
delete "/me/access_tokens", to: "access_tokens#destroy"
shallow do
resources :projects, only: [:index, :show, :create, :update, :destroy] do
resources :tasks, only: [:index, :show, :create, :update, :destroy]
end
end
get "/", to: "root#index", as: :api_root
match "*unmatched", to: "root#not_found", via: [:get]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment