rails link_to remote with params

我想使用链接触发模型的远程操作。 基本上所有这个链接需要做的是用一个参数触发一个方法。

这是我的代码:

= link_to 'Move Up', reorder_collection_folder_path(@collection, folder), :reorder => :up, :remote => true 

这确实按预期触发了文件夹#reorder控制器操作,但是:reorder参数未被传递。 我的日志说:

 Started GET "/collections/1/folders/1/reorder" for 127.0.0.1 at 2011-03-01 18:03:31 -0600 Processing by FoldersController#reorder as JS Parameters: {"collection_id"=>"1", "id"=>"1"} 

那么,我如何通过远程链接传递参数? 我在这做错了什么?

找到了解决方案。

对于远程链接,代码应为:

 = link_to 'Move Up', reorder_collection_folder_path(@collection, folder, :reorder=>:up), :remote => true 

IE的params需要进入路径助手。