README.md in audited-4.7.1 vs README.md in audited-4.8.0
- old
+ new
@@ -191,11 +191,11 @@
Outside of a request, Audited can still record the user with the `as_user` method:
```ruby
Audited.audit_class.as_user(User.find(1)) do
- post.update_attribute!(title: "Hello, world!")
+ post.update_attributes!(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.)
@@ -253,10 +253,15 @@
user.update_attribute!(name: "Steve Richert")
user.audits.last.associated # => #<Company name: "Collective Idea">
company.associated_audits.last.auditable # => #<User name: "Steve Richert">
```
+You can access records' own audits and associated audits in one go:
+```ruby
+company.own_and_associated_audits
+```
+
### Conditional auditing
If you want to audit only under specific conditions, you can provide conditional options (similar to ActiveModel callbacks) that will ensure your model is only audited for these conditions.
```ruby
@@ -308,9 +313,15 @@
To disable auditing on an entire model:
```ruby
User.auditing_enabled = false
+```
+
+To disable auditing on all models:
+
+```ruby
+Audited.auditing_enabled = false
```
### Custom `Audit` model
If you want to extend or modify the audit model, create a new class that