Giter Site home page Giter Site logo

delayed_crud's Introduction

DelayedCrud

The delayed_crud gem simplifies database CRUD operations in your Ruby on Rails applications by utilizing preconfigured Sidekiq background jobs.

Installation

To install the gem run the following command in the terminal:

$ bundle add delayed_crud

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install delayed_crud

Usage

This gem provides three convenient methods for common CRUD operations, each accepting timer arguments with keywords :in and :after. Please note that the timer starts counting down as soon as the code line is executed. Since the gem relies on sidekiq, the execution timing might not be precise.

delayed_create

The delayed_create method can be used on a model instance and accepts instance attributes in a hash along with a timer argument.

  Customer.delayed_create({ status: :new }, in: 10.minutes.from_now)

delayed_update

The delayed_update method works on an existing record and accepts update attributes in a hash along with a timer argument.

  HeatedDiscussion.delayed_update({ frozen: false }, after: 24.hours)

delayed_destroy

The delayed_destroy method can be used on an existing record and accepts only a timer argument. The record will be destroyed once the timer expires.

TrialAccount.delayed_destroy(in: 1.week.from_now)

Contributing

The best way to contribute would be to fork this repo, create a new branch from main, to merge the branch into main of the fork once the new code is in place and then open a pull request to merge forked main into the main of the present repo.

Bug reports and pull requests are welcome on GitHub at https://github.com/msuliq/delayed_crud. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the DelayedCrud project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

delayed_crud's People

Contributors

msuliq avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.