
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
will_paginate_infinite
Advanced tools
Include the gem in your Gemfile:
gem 'will_paginate_infinite'
And then execute:
$ bundle install
Adds to app/assets/stylesheets/application.scss
:
*= require will_paginate_infinite
And javascript to app/assets/javascripts/application.js
:
//= require will_paginate_infinite
In your index view pagination :
# app/views/news/index.html.erb
<h1>News List</h1>
<div class="list-news">
<ul>
<% @news.each do |item| %>
<%= render item %>
<% end %>
</ul>
<%= will_paginate @news, renderer: WillPaginateInfinite::InfinitePagination %>
</div>
Will paginate renderer: WillPaginateInfinite::InfinitePagination
In content partial view:
# app/views/news/_news.html.erb
<li>
<%= item.title %>
</li>
And in controller/action with items to be paginated:
# app/controllers/news_controller.rb
class NewsController < ApplicationController
def index
@news = News.order(:created_at).paginate(:page => params[:page], :per_page => 30)
# ...
respond_to do |format|
format.html
format.js
end
end
end
Creates a javascript version from your index view:
# app/views/news/index.js.erb
<%= infinite_append ".list-news ul", @news %>
or
# app/views/news/index.js.erb
<%= infinite_append ".list-news ul", { partial: "news/news", collection: @news } %>
Example using will_paginate_infinite with Rails 4: https://github.com/Godoy/will_paginate_infinite_example
FAQs
Unknown package
We found that will_paginate_infinite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.