New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

act_as_backdrop

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

act_as_backdrop

  • 0.0.4
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

acts_as_backdrop

This gem allows you to write async processing code to your models right into your models code.

Build Status Gem Version

Example

class Something < ActiveRecord::Base
  acts_as_backdrop

  def backdrop_process(message)

    # This will be processed asyncronously after model save.
    # Example that you receive as 'message' variable:
    #
    # { "class"   => "Something",
    #   "gid"     => "gid://dummy/Something/1",
    #   "changes" => {
    #     "title"      => [nil, "abc"],
    #     "created_at" => [nil, "2015-12-17T20:28:52.307Z"],
    #     "updated_at" => [nil, "2015-12-17T20:28:52.307Z"],
    #     "id"         => [nil, 1]
    #   }
    # }

  end

end

Why

Because you might need to process some data after the model is saved, asynchronously.

Installation

gem 'act_as_backdrop' # Gemfile
require 'backdrop'    # application.rb

How it works

When your model instance saved (on after_save callback), the model itself and it's changes published to async job queue as usual DelayedJob. The special worker (BackdropJob class) will process this message and will trigger your 'backdrop_process' method inside your model.

You receive full information about model changes, and can process it as you wish. If you change the model state at this step, the next async task will happen and be processed in same way.

FAQs

Package last updated on 18 Dec 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc