Re: Rails parameters get lost because of jQuery link

47 views
Skip to first unread message

Frederick Cheung

unread,
Feb 12, 2013, 3:20:33 PM2/12/13
to rubyonra...@googlegroups.com


On Tuesday, February 12, 2013 1:57:58 PM UTC, Andreas Fritz wrote:

The defaults are 'name' for sort and 'basic' for tag. They are set in methods within the controller and model for not being redundant.

The linking itself works perfectly fine and the jQuery itself, too. However if I add the jQuery to the linking, the parameters will not get passed and so can not be merged. I guess when the page is reloaded there is no parameter set and jQuery does not pass the first one I click on. Though somehow in Ryan Bates' Railscast it does work and even if I download it, it works just fine. Does anybody know what the mistake might be?


The mistake is that your links aren't updated because you are only re-rendering your content section. You could re-render a large part of the page, including the links. The railscast takes a slightly different approach - he users extra hidden fields in the bits of the page that are re-rendered so that even though the link doesn't have the previously selected order/sort in it, it can be retrieved from the form

Fred

Andreas Fritz

unread,
Feb 12, 2013, 3:39:55 PM2/12/13
to rubyonra...@googlegroups.com
Wow, I never would have thought of that. Thank you so much, you made my day =).
Reply all
Reply to author
Forward
0 new messages