README.md in audited-4.4.1 vs README.md in audited-4.5.0
- old
+ new
@@ -25,21 +25,21 @@
## Installation
Add the gem to your Gemfile:
```ruby
-gem "audited", "~> 4.4"
+gem "audited", "~> 4.5"
```
Then, from your Rails app directory, create the `audits` table:
```bash
$ rails generate audited:install
$ rake db:migrate
```
-If you're using PostgreSQL, then you can use `rails generate audited:install --audited-changes-column-type jsonb` (or `json`) to store audit changes natively with its JSON column types.
+If you're using PostgreSQL, then you can use `rails generate audited:install --audited-changes-column-type jsonb` (or `json`) to store audit changes natively with its JSON column types. If you're using something other than integer primary keys (e.g. UUID) for your User model, then you can use `rails generate audited:install --audited-user-id-column-type uuid` to customize the `audits` table `user_id` column type.
#### Upgrading
If you're already using Audited (or acts_as_audited), your `audits` table may require additional columns. After every upgrade, please run:
@@ -167,9 +167,11 @@
Audited.audit_class.as_user(User.find(1)) do
post.update_attribute!(title: "Hello, world!")
end
post.audits.last.user # => #<User id: 1>
```
+
+The standard Audited install assumes your User model has an integer primary key type. If this isn't true (e.g. you're using UUID primary keys), you'll need to create a migration to update the `audits` table `user_id` column type. (See Installation above for generator flags if you'd like to regenerate the install migration.)
#### Custom Auditor
You might need to use a custom auditor from time to time. It can be done by simply passing in a string: