Unexpected results when using "sort_link" helper in Ransack Gem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Unexpected results when using "sort_link" helper in Ransack Gem

David McDonald

I'm trying to add my search criteria to my sort_link method that's provided by the Ransack gem. Below is a an example of what I get when debugging the application.


(byebug) ransack_search_object
Ransack::Search<class: Player, base: Grouping <conditions: [Condition <attributes: ["position_id"], predicate: in, values: ["", "5"]>, Condition <attributes: ["measurable_summary_height"], predicate: gteq, values: ["6060"]>], combinator: and>>

(byebug) sort_link(ransack_search_object, "Pos", %i(position_abbreviation), { controller: "players", action: "ransack_search" })
"<a class=\"sort_link \" href=\"/players/ransack_search?q%5Bs%5D=position_abbreviation+asc\">Pos</a>"



As you can see above the search criteria is specified in ransack_search_object, but it doesn't appear in the href link that is generated. I'm not sure why this is the case though.  Anyone have any ideas or suggestions I could try?  Thanks!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/eb778bc5-d154-43e7-abbe-aa085df1cc11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.