<commit_before># will_paginate

This version of `will_paginate` is optimized for Rails 5 on Ruby 2.2+ and
compatibility with the [Ransack](https://github.com/activerecord-hackery/ransack)
search gem:

- Strings are now frozen to be immutable, to reduce object allocations and memory use.
- Rails 5 composes ActionController::Parameters as a HWIA instead of inheriting from Hash. Ransack needs nested options hashes in AC::Parameters to be parsed correctly. This is handled here.
- Legacy code for Rails 2 and 3 and Merb was removed to make the gem more lightweight.

Installation:

```ruby
gem 'will_paginate', github: 'jonatack/will_paginate'
```

## Basic use

In the controller:

```ruby
  # perform a paginated query
  @posts = Post.paginate(page: params[:page])

  # use an explicit "per page" limit
  Post.paginate(page: params[:page], per_page: 30)

  # will_paginate returns a chainable Active Record relation
  Post.where(published: true).paginate(page: params[:page]).order(id: :desc)

  # the new, shorter #page method
  Post.page(params[:page]).order(created_at: :asc)
```

In the view, to render pagination links:

```erb
  <%= will_paginate @posts %>
```

And that's it! You just need to add some CSS styles to [make those pagination links prettier](http://mislav.uniqpath.com/will_paginate).

You can customize the default "per_page" value:

``` ruby
  # for the Post model
  class Post
    self.per_page = 10
  end

  # set per_page globally
  WillPaginate.per_page = 10
```

Happy paginating! :heart:<commit_msg>Fix broken CSS styles link in README with updated working one.<commit_after># will_paginate

This version of `will_paginate` is optimized for Rails 5 on Ruby 2.2+ and
compatibility with the [Ransack](https://github.com/activerecord-hackery/ransack)
search gem:

- Strings are now frozen to be immutable, to reduce object allocations and memory use.
- Rails 5 composes ActionController::Parameters as a HWIA instead of inheriting from Hash. Ransack needs nested options hashes in AC::Parameters to be parsed correctly. This is handled here.
- Legacy code for Rails 2 and 3 and Merb was removed to make the gem more lightweight.

Installation:

```ruby
gem 'will_paginate', github: 'jonatack/will_paginate'
```

## Basic use

In the controller:

```ruby
  # perform a paginated query
  @posts = Post.paginate(page: params[:page])

  # use an explicit "per page" limit
  Post.paginate(page: params[:page], per_page: 30)

  # will_paginate returns a chainable Active Record relation
  Post.where(published: true).paginate(page: params[:page]).order(id: :desc)

  # the new, shorter #page method
  Post.page(params[:page]).order(created_at: :asc)
```

In the view, to render pagination links:

```erb
  <%= will_paginate @posts %>
```

And that's it! You just need to add some CSS styles to [make those pagination links prettier](http://mislav.github.io/will_paginate/).

You can customize the default "per_page" value:

``` ruby
  # for the Post model
  class Post
    self.per_page = 10
  end

  # set per_page globally
  WillPaginate.per_page = 10
```

Happy paginating! :heart:
{'fraction_non_alphanumeric': 0.0998389694041868, 'fraction_numerical': 0.007729468599033816, 'mean_word_length': 4.477954144620811, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5841444', 'n_tokens_mistral': 1031, 'n_tokens_neox': 946, 'n_words': 365}