Module: Pading::HelperMethods
- Defined in:
- lib/pading/actionview/helper_menthods.rb
Instance Method Summary collapse
Instance Method Details
#test_paginate(scope, paginator_class: Pading::Actionview::Paginator, template: nil, **options) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pading/actionview/helper_menthods.rb', line 8 def test_paginate(scope, paginator_class: Pading::Actionview::Paginator, template: nil, **) # scope.class -> User::ActiveRecord_Relation # 所以能调用 PageScopeMenthods 下面的方法 [:total_pages] ||= scope.total_pages .reverse_merge! current_page_number: scope.current_page, per_page: scope.limit_value, remote: false # 最后返回的 其实是一个渲染好的模板。 paginator = paginator_class.new (template || self), paginator.to_s end |