2

I have integrated spree with my application. I have overridden spree-user model to user model. I am trying to override api/users to come to my UsersController but instead everytime when I make a call to /api/users/, the control goes to Spree::Api::UsersController. I have the following route for user

namespace :api do
  resources :users
end

But still my routes are overridden. What changes should I do to route /api/users/ to my local controller?

I-am-batman
  • 187
  • 6

1 Answers1

1

Try using Spree::Core::Engine.routes.prepend in routes.rb:

Spree::Core::Engine.routes.prepend do
  namespace :api do
    resources :users
  end
end

Alternatively, try appending main_app when you call the route in your view code, eg:

main_app.api_users_path

Not sure if you have tried that already but hopefully it helps. You can read more at the SO threads below:

Community
  • 1
  • 1
Tom Kadwill
  • 1,448
  • 3
  • 15
  • 21