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”

Hi!

On Mon, Sep 19, 2011 at 10:57 AM, slava [email protected] wrote:

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 M. 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

For what purpose would you need to route to a parent controller?