Project

load_more

0.0
No commit activity in last 3 years
No release in over 3 years
load_more provides a simple solution for performing load more queries with ActiveRecord.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 3.2.0, ~> 3.2
>= 1.3.0, ~> 1.3

Runtime

 Project Readme

LoadMore¶ ↑

A simple solution for performing load more queries with ActiveRecord

Installation¶ ↑

In your Gemfile:

gem 'load_more'

Then run

bundle install

Usage¶ ↑

Query¶ ↑

Article.load_more(last_load: params[:last_load_id])
Article.last_load(params:[last_load_id])

Configuring global default value¶ ↑

In config/initializers/load_more.rb:

LoadMore.configure do |config|
  config.load_limit = 10
  config.sort_column = :id
  config.sort_method = :desc
end

The above is the default configuration.

Configuring default value for each model¶ ↑

In your model:

class Article < ActiveRecord::Base
  self.load_limit = 15
  self.sort_column = :unique_id
  self.sort_method = :desc
end

Configuring default values for each query¶ ↑

Article.load_more(load_limit: 20, sort_column: :sku, sort_method: :asc, last_load: 99)

License¶ ↑

This project rocks and uses MIT-LICENSE.