Use `before_action` instead of `before_filter`
This commit is contained in:
parent
7d60a41e13
commit
ea50cea016
|
@ -106,8 +106,8 @@
|
||||||
- [#556](https://github.com/airblade/paper_trail/pull/556) /
|
- [#556](https://github.com/airblade/paper_trail/pull/556) /
|
||||||
[#301](https://github.com/airblade/paper_trail/issues/301) -
|
[#301](https://github.com/airblade/paper_trail/issues/301) -
|
||||||
If you are tracking who is responsible for changes with `whodunnit`, be aware
|
If you are tracking who is responsible for changes with `whodunnit`, be aware
|
||||||
that PaperTrail no longer adds the `set_paper_trail_whodunnit` before_filter
|
that PaperTrail no longer adds the `set_paper_trail_whodunnit` before_action
|
||||||
for you. Please add this before_filter to your ApplicationController to
|
for you. Please add this before_action to your ApplicationController to
|
||||||
continue recording whodunnit. See the readme for an example.
|
continue recording whodunnit. See the readme for an example.
|
||||||
- [#683](https://github.com/airblade/paper_trail/pull/683) /
|
- [#683](https://github.com/airblade/paper_trail/pull/683) /
|
||||||
[#682](https://github.com/airblade/paper_trail/issues/682) -
|
[#682](https://github.com/airblade/paper_trail/issues/682) -
|
||||||
|
|
|
@ -94,7 +94,7 @@ by adding a controller callback.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
class ApplicationController
|
class ApplicationController
|
||||||
before_filter :set_paper_trail_whodunnit
|
before_action :set_paper_trail_whodunnit
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -691,12 +691,12 @@ widget.versions.last.whodunnit # Andy Stewart
|
||||||
```
|
```
|
||||||
|
|
||||||
If your controller has a `current_user` method, PaperTrail provides a
|
If your controller has a `current_user` method, PaperTrail provides a
|
||||||
`before_filter` that will assign `current_user.id` to `PaperTrail.whodunnit`.
|
`before_action` that will assign `current_user.id` to `PaperTrail.whodunnit`.
|
||||||
You can add this `before_filter` to your `ApplicationController`.
|
You can add this `before_action` to your `ApplicationController`.
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
class ApplicationController
|
class ApplicationController
|
||||||
before_filter :set_paper_trail_whodunnit
|
before_action :set_paper_trail_whodunnit
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
After upgrading to PaperTrail 5, you see this warning:
|
After upgrading to PaperTrail 5, you see this warning:
|
||||||
|
|
||||||
> user_for_paper_trail is present, but whodunnit has not been set. PaperTrail no
|
> user_for_paper_trail is present, but whodunnit has not been set. PaperTrail no
|
||||||
> longer adds the set_paper_trail_whodunnit before_filter for you. Please add this
|
> longer adds the set_paper_trail_whodunnit before_action for you. Please add this
|
||||||
> before_filter to your ApplicationController to continue recording whodunnit.
|
> before_action to your ApplicationController to continue recording whodunnit.
|
||||||
|
|
||||||
## You want to track whodunnit
|
## You want to track whodunnit
|
||||||
|
|
||||||
Add the set_paper_trail_whodunnit before_filter to your ApplicationController.
|
Add the set_paper_trail_whodunnit before_action to your ApplicationController.
|
||||||
See the PaperTrail readme for an example (https://git.io/vrsbt).
|
See the PaperTrail readme for an example (https://git.io/vrsbt).
|
||||||
|
|
||||||
## You don't want to track whodunnit
|
## You don't want to track whodunnit
|
||||||
|
|
Loading…
Reference in New Issue