ruby 分页集锦
2016-06-01 11:38
337 查看
1.涉及elasticsearch搜索的 分页
all_loss_level=[1,2,3,5] page = params[:page] || 1 options=[] options<<{terms:{loss_level:all_loss_level}} @teacher=User.search(query:{bool:{must:[options]}},sort:{created_at:{order:"desc"}}).page(page).per(per_page) <div class="p_page"> <% if defined? flag%> <%= paginate @teacher%> <%else%> <%= paginate @teacher,:remote=>true%> <%end%> </div>
相关文章推荐
- ruby之动态方法
- ruby Rails学习资料
- 2016年5月编程语言排行榜:Ruby排名创历史新高
- 冒泡排序算法及Ruby版的简单实现
- [Ruby笔记]18.Ruby 继承 Inheritance 与 .superclass
- 问题解决:安装完ruby却提示[/usr/bin/ruby: No such file or directory]
- [Ruby笔记]17.Ruby attribute attr_reader attr_writer attr_accessor attr
- [Ruby笔记]16.Ruby 判断数字 .is_a?(Numeric) .to_i
- mac下用ruby安装sass && webstorm下给scss文件添加watch
- Ruby, an interesting Functional Programming
- Monkey Patch猴子补丁编程方式及其在Ruby中的运用
- Ruby使用Monkey Patch猴子补丁方式进行程序开发的示例
- Ruby面向对象编程中类与方法的基础学习
- 详解Ruby中的代码块及其参数传递
- 深入理解Ruby中的代码块block特性
- Ruby中的block代码块学习教程
- Ruby中的Proc类及Proc的类方法Proc.new的使用解析
- 详解Ruby中的代码块对象Proc
- CGI:common gateway interface通用网关接口
- [Ruby笔记]15.@instance_variable 以及 糖“在方法名中可使用=”