routing question

Hello, I wonder how to tell my routes.rb to route requests to a resource to it's parent controller

class Foo < Bar end

resources :foos ===> controller :bars

Check out the guide for routing, especially the part on “specifying a controller to use” under “customizing restful resources”

http://guides.rubyonrails.org/routing.html#customizing-resourceful-routes

Hi!

Hello,

I wonder how to tell my routes.rb to route requests to a resource to

it’s parent controller

I don’t know if what I will say is the “Rails Way”, but maybe you can try:

  1. Define in your config/routes.rb

resources :foos

  1. Create a Controller that Inherits from Bar

class FoosController < BarsController

  1. Reuse the methods you need calling super():

class FoosController < BarsController

def create

super()

end

end

Best Regards,

Everaldo

Slava Mikerin wrote in post #1022739:

Hello, I wonder how to tell my routes.rb to route requests to a resource to it's parent controller

class Foo < Bar end

resources :foos ===> controller :bars

resources :foos, :controller => :bars