routing question

9 views
Skip to first unread message

slava

unread,
Sep 19, 2011, 9:57:05 AM9/19/11
to Ruby on Rails: Talk
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

Tim Shaffer

unread,
Sep 19, 2011, 10:01:29 AM9/19/11
to rubyonra...@googlegroups.com
Check out the guide for routing, especially the part on "specifying a controller to use" under "customizing restful resources"

Everaldo Gomes

unread,
Sep 19, 2011, 10:06:41 AM9/19/11
to rubyonra...@googlegroups.com
Hi!

On Mon, Sep 19, 2011 at 10:57 AM, slava <mikeri...@gmail.com> 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


2. Create a Controller that Inherits from Bar

class FoosController < BarsController

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

class FoosController < BarsController

   def create
       super()
    end

end

Best Regards,

Everaldo

 
class Foo < Bar
end


resources :foos  ===> controller :bars

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


7stud --

unread,
Sep 19, 2011, 6:50:00 PM9/19/11
to rubyonra...@googlegroups.com
Slava Mikerin wrote in post #1022739:

resources :foos, :controller => :bars

--
Posted via http://www.ruby-forum.com/.

Reply all
Reply to author
Forward
0 new messages