Skip to content

Commit 2bd37d2

Browse files
committed
Remove path attribute in routes
1 parent 9499efd commit 2bd37d2

9 files changed

+22
-22
lines changed

rails5/en/chapter02-api.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Up to this point we have not made anything crazy. What we want to to generate a
138138
----
139139
Rails.application.routes.draw do
140140
# Api definition
141-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
141+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
142142
# We are going to list our resources here
143143
end
144144
end
@@ -176,7 +176,7 @@ At this point we should have a nice routes mapping using a subdomain for name sp
176176
----
177177
Rails.application.routes.draw do
178178
# Api definition
179-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
179+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
180180
# We are going to list our resources here
181181
end
182182
end
@@ -198,7 +198,7 @@ This way we can scope our api into different versions very easily, now we just n
198198
----
199199
Rails.application.routes.draw do
200200
# Api definition
201-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
201+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
202202
scope module: :v1 do
203203
# We are going to list our resources here
204204
end
@@ -348,7 +348,7 @@ As you imagine we need to add the class to our `routes.rb` file and set it as a
348348
# ...
349349
Rails.application.routes.draw do
350350
# Api definition
351-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
351+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
352352
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
353353
# We are going to list our resources here
354354
end

rails5/en/chapter03-presenting-users.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ This kind of error if very common when generating endpoints manually, we totally
347347
Rails.application.routes.draw do
348348
devise_for :users
349349
# Api definition
350-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
350+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
351351
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
352352
resources :users, only: [:show]
353353
end

rails5/en/chapter06-user-products.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ Wait! Don’t run the tests yet. Remember we need to add the resource to the `ro
400400
# ...
401401
Rails.application.routes.draw do
402402
# ...
403-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
403+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
404404
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
405405
# ...
406406
resources :products, only: [:show]
@@ -587,7 +587,7 @@ One last thing before you run your tests, just the necessary route:
587587
# ...
588588
Rails.application.routes.draw do
589589
# ...
590-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
590+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
591591
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
592592
resources :users, only: %i[show create update destroy] do
593593
resources :products, only: [:create]
@@ -620,7 +620,7 @@ We are first add the action to the routes, so we don’t forget later:
620620
# ...
621621
Rails.application.routes.draw do
622622
# ...
623-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
623+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
624624
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
625625
resources :users, only: %i[show create update destroy] do
626626
resources :products, only: %i[create update]
@@ -729,7 +729,7 @@ Let’s start again by adding the route name to the routes file:
729729
# ...
730730
Rails.application.routes.draw do
731731
# ...
732-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
732+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
733733
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
734734
resources :users, only: %i[show create update destroy] do
735735
resources :products, only: %i[create update destroy]

rails5/en/chapter08-placing-orders.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ If we run the test suite now, as you may expect, both tests will fail, because h
305305
# ...
306306
Rails.application.routes.draw do
307307
# ...
308-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
308+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
309309
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
310310
resources :users, only: %i[show create update destroy] do
311311
# ...

rails5/fr/chapter02-api.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Jusqu’à présent, nous n’avons rien fait de compliqué. Nous voulons mainte
153153
----
154154
Rails.application.routes.draw do
155155
# Api definition
156-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
156+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
157157
# We are going to list our resources here
158158
end
159159
end
@@ -186,7 +186,7 @@ A ce stade, nous devrions avoir un bon mappage des routes utilisant un sous-doma
186186
----
187187
Rails.application.routes.draw do
188188
# Api definition
189-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
189+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
190190
# We are going to list our resources here
191191
end
192192
end
@@ -207,7 +207,7 @@ De cette façon, nous pouvons très facilement définir la portée de notre API
207207
.config/routes.rb
208208
----
209209
Rails.application.routes.draw do
210-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
210+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
211211
scope module: :v1 do
212212
# We are going to list our resources here
213213
end
@@ -355,7 +355,7 @@ require 'api_constraints'
355355
356356
Rails.application.routes.draw do
357357
# Api definition
358-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
358+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
359359
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
360360
# We are going to list our resources here
361361
end

rails5/fr/chapter03-presenting-users.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ require 'api_constraints'
302302
Rails.application.routes.draw do
303303
devise_for :users
304304
# Api definition
305-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
305+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
306306
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
307307
resources :users, only: [:show]
308308
end

rails5/fr/chapter06-user-products.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ require 'api_constraints'
394394
395395
Rails.application.routes.draw do
396396
# ...
397-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
397+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
398398
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
399399
# ...
400400
resources :products, only: [:show]
@@ -597,7 +597,7 @@ Une dernière chose avant de faire vos tests: la route nécessaire:
597597
# ...
598598
Rails.application.routes.draw do
599599
# ...
600-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
600+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
601601
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
602602
resources :users, only: %i[show create update destroy] do
603603
resources :products, only: [:create]
@@ -630,7 +630,7 @@ Nous ajoutons d’abord l’action aux routes pour ne pas oublier plus tard:
630630
# ...
631631
Rails.application.routes.draw do
632632
# ...
633-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
633+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
634634
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
635635
resources :users, only: %i[show create update destroy] do
636636
resources :products, only: %i[create update]
@@ -739,7 +739,7 @@ Recommençons par ajouter la route:
739739
# ...
740740
Rails.application.routes.draw do
741741
# ...
742-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
742+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
743743
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
744744
resources :users, only: %i[show create update destroy] do
745745
resources :products, only: %i[create update destroy]

rails5/fr/chapter08-placing-orders.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ Si nous exécutons la suite de tests maintenant, comme vous pouvez vous y attend
302302
# ...
303303
Rails.application.routes.draw do
304304
# ...
305-
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' }, path: '/' do
305+
namespace :api, defaults: { format: :json }, constraints: { subdomain: 'api' } do
306306
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
307307
resources :users, only: %i[show create update destroy] do
308308
# ...

rails6/en/chapter02-api.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ At this point we should have a nice routes mapping using a namespace. Your _rout
202202
----
203203
Rails.application.routes.draw do
204204
# Api definition
205-
namespace :api, defaults: { format: :json }, path: '/' do
205+
namespace :api, defaults: { format: :json } do
206206
# We are going to list our resources here
207207
end
208208
end
@@ -224,7 +224,7 @@ This way we can scope our api into different versions very easily, now we just n
224224
----
225225
Rails.application.routes.draw do
226226
# Api definition
227-
namespace :api, defaults: { format: :json }, path: '/' do
227+
namespace :api, defaults: { format: :json } do
228228
scope module: :v1 do
229229
# We are going to list our resources here
230230
end

0 commit comments

Comments
 (0)