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
1 changed files with 4 additions and 8 deletions

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