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

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Tim Shaffer at Sep 19, 2011 at 2:01 pm
    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

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/EISJQTurhMgJ.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Everaldo Gomes at Sep 19, 2011 at 2:07 pm
    Hi!
    On Mon, Sep 19, 2011 at 10:57 AM, slava 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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to
    rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at
    http://groups.google.com/group/rubyonrails-talk?hl=en.
    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • 7stud -- at Sep 19, 2011 at 10:50 pm

    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

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

    --
    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 rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedSep 19, '11 at 1:57p
activeSep 19, '11 at 10:50p
posts4
users4
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase