diff --git a/README.md b/README.md index 9540d85a..3417320b 100644 --- a/README.md +++ b/README.md @@ -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). @@ -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: diff --git a/UPGRADING.md b/UPGRADING.md index ea45945a..e1f5051e 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -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) +```