mirror of
https://github.com/paper-trail-gem/paper_trail.git
synced 2022-11-09 11:33:19 -05:00
Refactor instructions for initializer to automatically defer whodunnit value from shell [ci skip]
This commit is contained in:
parent
10d8451d70
commit
a9bb8ddf1b
1 changed files with 4 additions and 8 deletions
12
README.md
12
README.md
|
@ -481,14 +481,10 @@ You can avoid having to do this manually by setting your initializer to pick up
|
|||
|
||||
```ruby
|
||||
# config/initializers/paper_trail.rb
|
||||
module PaperTrail
|
||||
class Version < ActiveRecord::Base
|
||||
if defined?(::Rails::Console)
|
||||
PaperTrail.whodunnit = "#{`whoami`.strip}: console"
|
||||
elsif File.basename($0) == "rake"
|
||||
PaperTrail.whodunnit = "#{`whoami`.strip}: rake #{ARGV.join ' '}"
|
||||
end
|
||||
end
|
||||
if defined?(::Rails::Console)
|
||||
PaperTrail.whodunnit = "#{`whoami`.strip}: console"
|
||||
elsif File.basename($0) == "rake"
|
||||
PaperTrail.whodunnit = "#{`whoami`.strip}: rake #{ARGV.join ' '}"
|
||||
end
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue