Add Progress Bar in Ruby on Rails Application

Add Progress Bar in Ruby on Rails Application

Okay, today I would like to show how to add progress bar in Ruby on Rails application. For add progress bar in Ruby on Rails application I use nprogress-rails ruby gem.

Installation
Add nprogress-rails ruby gem to Gemfile:

Gemfile
1
gem 'nprogress-rails'

And then open terminal type:

1
$ bundle

Usage
Add the requires to the application.js:

application.js
1
2
//= require nprogress
//= require nprogress-turbolinks

Also, into the application.css.scss:

application.css.scss
1
2
*= require nprogress
*= require nprogress-bootstrap

And then, add NProgress.start(); to application.js for loading progress bar whenever you load each pages:

application.js
1
2
3
$(document).ready(function() {
  NProgress.start();
});

So far so good, let enjoy the progress bar in your application. Thank for reading :)