From f75005e1bc15101f37d377b7ed06f877dc206ee0 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 10 Jan 2013 10:17:31 +0100 Subject: moved api routes into their own namespace In case we need them at some point - now it's new_api_user_path instead of new_user_path for example. This way they should not conflict with the normal route generation --- users/config/routes.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'users/config') diff --git a/users/config/routes.rb b/users/config/routes.rb index 8985502..723d737 100644 --- a/users/config/routes.rb +++ b/users/config/routes.rb @@ -1,8 +1,12 @@ Rails.application.routes.draw do - scope "/1", :module => "V1", defaults: {format: 'json'} do - resources :sessions, :only => [:new, :create, :update, :destroy] - resources :users, :only => [:create] + constraints :subdomain => "api" do + namespace "api", :path => nil do + scope "/1", :module => "V1", defaults: {format: 'json'} do + resources :sessions, :only => [:new, :create, :update, :destroy] + resources :users, :only => [:create] + end + end end get "login" => "sessions#new", :as => "login" -- cgit v1.2.3 From 1cf4cc5c8d571b571367a08f5e201be868289ed1 Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 16 Jan 2013 13:16:38 +0100 Subject: using subdomain for api requests properly --- users/config/routes.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'users/config') diff --git a/users/config/routes.rb b/users/config/routes.rb index 723d737..0c2d8d9 100644 --- a/users/config/routes.rb +++ b/users/config/routes.rb @@ -1,11 +1,11 @@ Rails.application.routes.draw do constraints :subdomain => "api" do - namespace "api", :path => nil do - scope "/1", :module => "V1", defaults: {format: 'json'} do - resources :sessions, :only => [:new, :create, :update, :destroy] - resources :users, :only => [:create] - end + namespace "api", { module: "V1", + path: "/1/", + defaults: {format: 'json'} } do + resources :sessions, :only => [:new, :create, :update, :destroy] + resources :users, :only => [:create] end end -- cgit v1.2.3