This isn’t an error in the text, but it’s a good teaching opportunity.
In the section where you add the scope ‘(:locale)’ to routes.rb, the text should note that this must be at the very bottom of your routes.rb file or else any resources after it will not route to the correct controller. It’s implicit in the code example, but should be called out in the text because it’s a common ‘gotcha’ and an easy mistake to make. You also need to take a look any time you generate a new resource to make sure it is above the scope ‘(:locale)’ block
# GOOD: This is what you need to do
# All other routes
resources :products do
get :who_bought, on: :member
end
scope '(:locale)' do
resources :orders
resources :line_items
resources :carts
root 'store#index', as: 'store_index'
end
end
# end of routes file
# BAD: You will never see your products page again
scope '(:locale)' do
resources :orders
resources :line_items
resources :carts
root 'store#index', as: 'store_index'
end
resources :products do
get :who_bought, on: :member
end
end
# end of routes file