Sha256: dc1ab34d4e499307ced3b7b072acea2b2828c917ea3c0ba587e08916817c67fd

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

# TransactionTimestamps

Transaction timestamps sets a Rails model's `created_at` and `updated_at` timestamps to the database transaction time, 
rather than the current time. This is useful for aligning the timestamps of different models saved within a single
transaction to be exactly the same.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'transaction_timestamps'
```

And then execute:

    $ bundle install

Or install it yourself as:

    $ gem install transaction_timestamps

## Usage

In an initializer (eg. `config/initializers/transaction_timestamps.rb`), flag on transaction timestamps:
    
    TransactionTimestamps.enabled = true

Any models created or updated within a transaction will then get the transaction timestamp.

Note: For postgresql databases, the timestamp is generated from a SQL query for the actual transaction time. For other
databases (where querying the transaction time is not supported), the current system time as of the first timestamping
event in the transaction is used.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/coupa/transaction_timestamps.


## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
transaction_timestamps-0.1.0 README.md