It's pretty simple for paginate of rails when used gem will_paginate
1、instatl gem will_paginate
sudo gem install will_paginate
2、create a rails project
rails blog
cd blog
./script/server
in browser enter http://localhost:3000
OK......
3、use scaffold generate template
./script/generate scaffold post name:string
use gedit open app/PostController
add require 'will_paginate' before class name
change action index code
#@posts = Post.find(:all)
@posts = Post.paginate :page => params[:page], :per_page => 5
#/posts/index.html.erb
add <%= will_paginate @posts %>
4、in browser entry http://localhost:3000/posts, create two new post will show paginate
5、that's it, is pretty simple?
分享到:
相关推荐
will_paginate-bootstrap, 将 Twitter Bootstrap 分页组件与will_paginate集成 will_paginate-bootstrap不再维护我不再使用 Bootstrap 来使用 Rails,所以不幸的是,我不再接受请求请求或者维护这个库。 为了发布你...
rails 分页插件will_paginate 2.2.2
will_paginate分页插件 博文链接:https://foxgst.iteye.com/blog/168489
rails 分页插件will_paginate 2.1.0
rails 分页插件will_paginate
cd will_paginate_endless_scroll_example 安装依赖: bundle install 迁移和种子数据库: bundle exec rake db:migrate db:seed 就是这样,它准备好了。 跑步: 像普通的 rails 应用程序一样运行: rails s ...
NULL 博文链接:https://liuyi-act-buaa-edu-cn.iteye.com/blog/506503
gem 'will_paginate-bootstrap4' 用法 <%= will_paginate @clients, renderer: WillPaginate::ActionView::BootstrapLinkRenderer %> 以下选项可用(除了will_paginate中可用的选项之外): :list_classes ...
因为需要安装svn比较麻烦,就直接手工下载了
安装: ## Gemfile for Rails 3+, Sinatra, and Merbgem 'will_paginate' , '~> 3.1.0' 有关更多信息,请参见Wiki上的。基本的will_paginate使用## perform a paginated query:@posts = Post . paginate ( page : ...
新版本的will_paginate已经抛弃了这样的做法,转而使用gem的方式,本文通过建立一个名为foobar的应用来了解一下will_paginate的用法。 ============================== C:\>rails foobar -d mysql C:\>cd foobar C:\...
will_paginate will_paginate是一个分页库,与Ruby on Rails,Sinatra,Hanami :: View,Merb,DataMapper和Sequel集成。 安装:##用于Rails 3 +,Sinatra和Merb的Gemfile gem'will_paginate','〜> will_paginate ...
示例排序的应用程序您需要此应用程序的sqlite3。Linux sudo apt-get install sqlite3sudo apt-get install libsqlite3-devMac OSX brew install sqlite然后git clone git://github....
资源分类:Python库 所属语言:Python 资源全名:mkdocs_paginate_plugin-0.0.3-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
=== Will Paginate App请参阅链接: ://richonrails.com/articles/getting-started-with-will-paginate了解更多信息。
概述这个 gem 提供了用于渲染分页组件的 Rails 视图助手。 它不会进行任何数据查询来拆分页面上的数据集合,而是假设集合已经分页并且总页数是已知的。 基本上它生成分页项目的 html 列表,其中每个项目可能链接到...
引导程序 will_paginate 状态机 魔幻 AWS-SDK 多雾路段 Validates_Timeliness 数据库设置 我已经包含了一个 config/database-sample.yml。 将此文件复制到 config/database.yml 并包含数据库服务器所需的凭据。