开发者

Rails Pagination for Articles / Strings?

I am aware and have regularly used Rails will_paginate. It's worked well for collections. Now, I'd like to use it to paginate a string. The application is paginating a long article. The article is a string and paginate expects a collection. I am not 开发者_如何学Pythonsure what to do. Do I covert the string into an array?

Is there a standard Rails way to accomplish this?


A band-aid solution would be to create a separate table. For example, you could have the model Post.has_many :pages.

Then all you have to do it paginate through @post.pages.order("page_number ASC").


gem 'html_slicer'

Requires Ruby 1.9.2/1.9.3 and Rails 3 or more.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜