新手问题 关于 will_paginate 分页的参数拼接问题!特殊字符被编码,后台错误!

stephen · April 30, 2013 · Last by stephen replied at May 01, 2013 · 2040 hits

因为需要按照分类查询,所以要输入一个 category 参数,代码如下:

<%= will_paginate @products, request.query_parameters.to_hash %>

参数格式

cpanel/products?category=2-0-0-0-&node_id=1

但是点击分页 2 时,变成了下面

cpanel?category%5B%5D=2&node_id=1&page=2

这样如何解决?

编码怎么了?会有问题吗?

@tumayun 我需要的是2-0-0这样的参数,它编码后,就会把我的参数改为了category%5B%5D=2,这样,我后台就会出错了,因为2-0-0-0我是每个数字代表不同的分类的!

@stephen 你确定是参数报错?不是 routes 报错?

@tumayun 呵呵!不是 routes 错,我只是在后台的根目录设为 products/index,所以才会cpanel?category这样

You need to Sign in before reply, if you don't have an account, please Sign up first.