Wednesday, January 11, 2017

Spawnling Gem in rails

Spawnling gem:

This gem provides a 'Spawnling' class to easily fork OR thread long-running sections of code so that your application can return results to your users more quickly. It works by creating new database connections in ActiveRecord::Base for the spawned block so that you don't have to worry about database connections working, they just do.

Step 1: Gem add in Gemfile:

            gem 'spawnling'

Step 2: Add in database.yml file

            production/development:
       ..............
       ..............
       reconnect: true

Step 3: Usages:

      Spawnling.new do

       @calendar.send_notification_to_team # method name

      end

3 comments: