Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved upgrading instructions to UPGRADING. Closes #87. #224

Merged
merged 1 commit into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ In your View, you might do something like (example in HAML format):

**Adding Userstamp on History Trackers**

To track the User in the application who created the HistoryTracker, please add the
To track the User in the application who created the HistoryTracker, add the
[Mongoid::Userstamp gem](https://github.com/tbpro/mongoid_userstamp) to your HistoryTracker class.
This will add a field called `created_by` and an accessor `creator` to the model (you can rename these via gem config).

Expand All @@ -400,15 +400,6 @@ class MyHistoryTracker
end
```

*Migrating Userstamp from Previous Versions*

Since October 2013 (mongoid-history version 0.4.1 and onwards), Mongoid::History itself no longer supports the userstamp natively. In order to migrate, follow the
instructions above then run the following command:

```
MyHistoryTracker.all.rename(modifier_id: :created_by)
```

**Setting Modifier Class Name**

If your app will track history changes to a user, Mongoid History looks for these modifiers in the ``User`` class by default. If you have named your 'user' accounts differently, you will need to add that to your Mongoid History config:
Expand Down
21 changes: 20 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,23 @@ See [#202](https://github.com/mongoid/mongoid-history/pull/202) for more informa

See [#189](https://github.com/mongoid/mongoid-history/pull/189) for more information.

* Currently, the `:all` option behaves identically to `:fields`. Future versions will track all fields and relations of trackable class when using `:all`.
* Currently, the `:all` option behaves identically to `:fields`. Future versions will track all fields and relations of trackable class when using `:all`.

### Upgrading to 0.4.1

#### Migrate Userstamp

`Mongoid::History` no longer supports the userstamp natively. To track the User in the application who created the HistoryTracker, add the [Mongoid::Userstamp gem](https://github.com/tbpro/mongoid_userstamp) to your HistoryTracker class.

```ruby
class MyHistoryTracker
include Mongoid::History::Tracker
include Mongoid::Userstamp
end
```

Rename the field.

```ruby
MyHistoryTracker.all.rename(modifier_id: :created_by)
```