am working in Rails version 2.3.8 Hash => agent_list = [[5, "val"], [4, "val"], [3, "val"], [1, "val"]]
<%= link_to_remote "Click Here",
:url => {
:controller => "controller",
:action => "method",
:id => @p_id,
:hash_list => hash_list
},
:method => 'post' %>
The link generated is :
[http://localhost/controller/method/12?hash_list%5B%5D%5B%5D=5&hash_list%5B%5D%5B%5D=val&hash_list%5B%5D%5B%5D=4&hash_list%5B%5D%5B%5D=val&hash_list%5B%5D%5B%5D=3&hash_list%5B%5D%5B%5D=val&hash_list%5B%5D%5B%5D=1&hash_list%5B%5D%5B%5D=val]
Could anyone tell me what is the right way to get something like: http://localhost/controller/method/12?hash_list=[hash_list]
so that i can use it as params[:agent_list] in my controller method.
P.S. sorry if its a nooby question.
Create a route in your
routes.rbto the action, if not already created, then:untested but should do the trick. If you're supplying
remote: truethen it doesn't really matter what your URL looks like, the hash should reside inparams[:hash]in your controller.link_to_remoteis deprecated in Rails 3+.Rails 2.3.8: