#37 ✓hold
Stuart Johnston

Nested resources

Reported by Stuart Johnston | December 10th, 2008 @ 07:58 AM

First and foremost... awesome plugin!

Spotted this...

If I'm using nested routes:


map.resources :activities do |activities|
    activities.resources :risks, :controller => "/activities/risks"
end

The wrong links are generated by order_by_link, per_page_select and page_select (and I presume the others).

The following:


order_by_link :name

renders


/activities/risks?activity_id=1&search%5Border_as%5D=DESC&search%5Border_by%5D=name

which generates an error. It should render something more like.


/activities/1/risks/?search%5Border_as%5D=DESC&search%5Border_by%5D=name

Is there a way to get it to use nested resources by passing in the appropriate object as can be done for form_for?

Comments and changes to this ticket

  • Stuart Johnston

    Stuart Johnston December 10th, 2008 @ 11:15 AM

    Ben

    My error.

    My route should have been:

    
    map.resources :activities do |activities|
        activities.resources :risks, :controller => "activities/risks"
    end
    

    The change is removing the first "/" from :controller => "activities/risks"

  • Ben Johnson

    Ben Johnson December 10th, 2008 @ 02:01 PM

    • State changed from “new” to “open”

    Hi Stuart,

    Well, all that searchlogic does is create parameters and pass them to link_to. For example, behind the scenes all that it is really doing is:

    link_to "Name", :search => {:order_by => :name}
    

    I'm assuming link_to delegates parameters to url_for and shouldn't url_for build the url as it is?

  • Ben Johnson

    Ben Johnson February 17th, 2009 @ 03:24 AM

    • State changed from “open” to “hold”

    Let me know if this is still an issue. I'm gonna put this on hold for now.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages