1
0
Fork 0
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:
Ben Atkins 2014-03-12 09:53:17 -04:00
parent 10d8451d70
commit a9bb8ddf1b

View file

@ -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
```