I'm trying to do a multi-column sort with the meta-search gem, but it's not working.
I'm doing it via some AJAX, so I'm calling Model.search()
directly. I think I'm doing it right, but I'm not 100% sure because I can't seem to find a good doc on what the "meta_sort" parameter should be.
This is what I'm effectively calling, where my model is "Trade":
Trade.search("meta_sort"=>"exch.asc,fcondt.asc")
Should it be an array instead of a csv string?
I know that this works for a single-column sort, e.g.
Trade.search("meta_sort"=>"exch.asc")
Any help is appreciated.
You can sort by many columns but single direction, "asc" direction is the default:
Syntax for fields of the same table:
{"meta_sort"=>"exch_and_fcondt.desc"}
Syntax for fields from different tables should be:
{"meta_sort"=>"table1_exch_and_table2_fcondt.desc"}