Marc Pursals
Marc Pursals

Reputation: 792

Moving controllers to new folder without changing routes

I'm refactoring a legacy code and one of the things it must be done is moving related controllers into a new folders. The thing is that it is a huge project and if I move the controllers I will need to redefine the paths on controllers and views which is quite impossible, also with the addition that maybe I will forgot something that it is no properly tested.

Is there any way to move controllers into folders without affecting the routes? Or is there any way to redefine easily the path of the resources? OR is there any easy way to say that a namespace don't has to add a prefix like 'api/controller#action? (don't add 'api/')

Thanks in advance.

Upvotes: 0

Views: 585

Answers (1)

Marc Pursals
Marc Pursals

Reputation: 792

For those how migth need an answer to this question it is on http://guides.rubyonrails.org/routing.html Just check 2.6 Controller Namespaces and Routing and you will find this:

enter image description here

Upvotes: 1

Related Questions