<commit_before># Mongoid::Archivable

Moves Mongoid documents to an archive instead of destroying them.

[ ![Codeship Status for Sign2Pay/mongoid-archivable](https://codeship.com/projects/a6d39180-c4c7-0132-bf85-1a3509ce6b71/status?branch=master)](https://codeship.com/projects/74192)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'mongoid-archivable'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install mongoid-archivable

## Usage

In any Mongoid document, do this:

```
include Mongoid::Archivable
```

Now a `destroy` of a document will move the document to an Archive collection, namespaced under the document you're destroying.

## Example

```
user = User.create! name: "Example User"
user.destroy

User.count # => 0
User::Archive.count # => 1
```

## Development

Please report any issues to the [GitHub issue tracker](https://github.com/Sign2Pay/mongoid-archivable/issues).
<commit_msg>add restore documentation to README<commit_after># Mongoid::Archivable

Moves Mongoid documents to an archive instead of destroying them.

[ ![Codeship Status for Sign2Pay/mongoid-archivable](https://codeship.com/projects/a6d39180-c4c7-0132-bf85-1a3509ce6b71/status?branch=master)](https://codeship.com/projects/74192)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'mongoid-archivable'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install mongoid-archivable

## Usage

In any Mongoid document, do this:

```
include Mongoid::Archivable
```

Now a `destroy` of a document will move the document to an Archive collection, namespaced under the document you're destroying.

You can restore an archive as well. Send the `.restore` message to it. For now the archived document is retained, but that might change in the future.

## Example

```
user = User.create! name: "Example User"
user.destroy

User.count # => 0
User::Archive.count # => 1

archived_user = User::Archive.last
archived_user.restore

User.count # => 1
User::Archive.count # => 1
```

## Development

Please report any issues to the [GitHub issue tracker](https://github.com/Sign2Pay/mongoid-archivable/issues).

{'fraction_non_alphanumeric': 0.11222627737226278, 'fraction_numerical': 0.029197080291970802, 'mean_word_length': 4.696103896103896, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1709644', 'n_tokens_mistral': 751, 'n_tokens_neox': 670, 'n_words': 216}