Sha256: 9e950c0d153e2378520eea1034db29cbf26654f9f5e548192aa7f147248108d2

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# 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.

Requires ActiveRecord 3.2+ (Check travis)

## 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 RunAfterCommit

  after_save :some_method

  def some_method
    run_after_commit do
      # Runs when the model 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
run_after_commit-0.0.1 README.md