Progressive Render

Episode #33 by Teacher's Avatar David Kimura

Summary

Slow content got you down? Load it later! Use this gem to defer loading of portions of your page until after load. They will be fetched via AJAX and placed on the page when ready.
rails performance ajax view 3:26

Resources

Summary

# Gemfile
gem 'progressive_render'

# application.js
//= require progressive_render

If you plan on using the default loader, you will need to also include the CSS asset.

# application.css
*= require progressive_render

# visitors_controller.rb
class VisitorsController < ApplicationController
  def index
    @users = User.all
    progressive_render
  end

  def images
    # Some task
    progressive_render
  end

  def census
    # Some task
    progressive_render
  end
end

# views
<%= progressive_render do %>
  Slow loading content here...
<% end %>