Add Gem:
Faye:
gem 'faye'
gem 'thin', require: false
gem 'sync'
OR
Pusher:
gem 'pusher'
gem 'sync'
Install Sync:
bundle
rails g sync:install
Include:
Application.js:
//= require sync
Application.html.rb:
Ruby > 2.0.0 :: <%= include_sync_config %>
Ruby <= 2.0.0 :: <%#= javascript_include_tag Sync.adapter_javascript_url %>
Model:
sync :all
Controller:
To apply on all action : enable_sync
Add on individual action : sync_new / sync_update / sync_destroy
Html page:
For Post model show/index page:
Show/Update :: <%= sync partial: 'post', collection: Post.all %>
New :: <%= sync_new partial: 'post', resource: Post.new %>
Sync Server:
rackup sync.ru -E production
Reference: Realtime render partials in Rails with Sync