-1

I want to click a heading and then sort the elements below it. So I have added link_to like this:

%th= link_to "Title"

after this I need to add parameter to send to my controller to sort the list. How do I add parameters? say the list needs to be sorted by "title" of the object.

And which function in my controller will receive the parameter?

I am a newbie so having trouble n tracing the data flow.

Ritu Raj
  • 543
  • 2
  • 6
  • 23

1 Answers1

1
link_to "Search Sort", index_path(:sort => "asc", :column => "title")
#=> <a href="/sort?sort=true&amp;column=test">Search Sort</a>
Simple Lime
  • 10,790
  • 2
  • 17
  • 32
Vaibhav Dhoke
  • 459
  • 6
  • 14