我想制作一个包含多个表格的页面。每个表都是 ajax 过滤表,可以使用元搜索进行排序。这是每个表的排序链接。控制器 SomeController:
def index
@search = FirstTable.search(params[:search])
@first_tables = @search.all
@search_second_table = SecondTable.search(params[:search_second_table])
@second_tables = @search_second_table.all
...
end
看法:
# First table
sort_link @search, :some_attribute, "Some Attribute"
#=> www.example.com/some_controller?search[meta_sort]=some_attribute.asc
# Second table
sort_link @search_second_table, :some_attribute, "Some Attribute"
#=> www.example.com/some_controller?search[meta_sort]=some_attribute.asc
我不知道为什么 sort_link 输出相同的链接,或者我犯了一些错误。无论如何将 second_table sort_link 的输出更改为这样。
#=> www.example.com/some_controller?search_second_table[meta_sort]=some_attribute.asc
谢谢你的帮助。