Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mrkamel/run_after_commit
Run code in an ActiveRecord model after it is committed
https://github.com/mrkamel/run_after_commit
Last synced: 23 days ago
JSON representation
Run code in an ActiveRecord model after it is committed
- Host: GitHub
- URL: https://github.com/mrkamel/run_after_commit
- Owner: mrkamel
- License: mit
- Created: 2015-02-10T15:54:15.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-31T16:25:05.000Z (almost 9 years ago)
- Last Synced: 2024-10-09T16:47:41.422Z (about 1 month ago)
- Language: Ruby
- Size: 9.77 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# RunAfterCommit
[![Build Status](https://secure.travis-ci.org/mrkamel/run_after_commit.png?branch=master)](http://travis-ci.org/mrkamel/run_after_commit)
Run code in an ActiveRecord model after it is committed
or immediately if you're outside of a transaction.## Installation
Add this line to your application's Gemfile:
```ruby
gem 'run_after_commit'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install run_after_commit
## Usage
Include `RunAfterCommit` in your model and queue some code:
```ruby
class SomeModel < ActiveRecord::Base
include RunAfterCommitafter_save :some_method
def some_method
run_after_commit do
# Runs when the transaction is committed
end
end
end
```## Contributing
1. Fork it ( https://github.com/mrkamel/run_after_commit/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request