开发者

will_paginate error in rails

Excuse me I have a problem with will_paginate plugin.

In localho开发者_如何学Pythonst, in my controller, I use person.operations.descend_by_date.paginate :page => params[:page] || 1. However in production the method show error. I think that the problem is thye parameter page. Because person.operation.descend_by_date return a collection i try passing only params[:page] || 1.

However in localhost show error. The rare subject is:

If I evaluate the method once => Show error IF i evaluate the method twice or more times => works ok

Rails show this message error: hash parameters expected

Why could be the error?


First i convert the will_paginate object to array and then i use the method for arrays of will_paginate

person.operations.descend_by_date.to_a.paginate params[:page] || 1

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜