For a similar sort of problem I extended sort_link_helper, allowing it
to accept a hash of options. I then used the options to override the
controller/action/etc as needed. If you use a signature like:
sort_link_helper(text, params, options={}) you won''t have to change
the code anywhere else.
HTH,
AndyV
On Mar 16, 6:30 am, carp __
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hello Rubyists,
>
> I ran into a problem with sorting a table (rendered in a partial) using
> the sort_link_helper methods after I have submitted data and re-rendered
> the table through an AJAX request.
>
> The setup is a follows:
>
> The table is a shared partial of Controller1 and Controller2 accessible
> via "shared/table". The AJAX''ed sorting using the sort
helper works all
> fine on Controller1.
>
> An AJAX link in the table refers to a method named "mymethod" on
> Controller2. Controller2 does what is expected from it and does a render
> :partial => "shared/table" and the table is correctly
displayed.
>
> However, the links generated by sort_link_helper change to the format of
>
"/controller2/mymethod?aknownname=111802211&sort=my_sort_value"
> instead of the expected (or desired)
> "/controller1/list?sort=my_sort_value".
>
> The corresponding method in Controller2 looks like this:
>
> def mymethod
> # ... some code
> if xhr?
> render :partial => "shared/partial", :layout => false
> end
> end
>
> How can I tell the rendered partial to use links based on
> "/controller1/list"? Thanks a lot in advance.
>
> --
> Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---