Use ::Kernel.warn instead of implicit receiver warn

Some people override warn in their applications. Using an explicit
receiver protects against this.

[Fixes #791]
This commit is contained in:
Jared Beck 2016-05-04 13:19:30 -04:00
parent ad0a7d7469
commit 99ccfd73cb
3 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,18 @@
## 5.0.1 (Unreleased)
### Breaking Changes
- None
### Added
- None
### Fixed
- [#791](https://github.com/airblade/paper_trail/issues/791) -
A rare issue in applications that override `warn`.
## 5.0.0 (2016-05-02)
### Breaking Changes

View File

@ -40,7 +40,7 @@ module PaperTrail
def add_paper_trail_migration(template)
migration_dir = File.expand_path("db/migrate")
if self.class.migration_exists?(migration_dir, template)
warn "Migration already exists: #{template}"
::Kernel.warn "Migration already exists: #{template}"
else
migration_template "#{template}.rb", "db/migrate/#{template}.rb"
end

View File

@ -94,7 +94,7 @@ module PaperTrail
user_present = user_for_paper_trail.present?
whodunnit_blank = ::PaperTrail.whodunnit.blank?
if enabled && user_present && whodunnit_blank && !@set_paper_trail_whodunnit_called
warn <<-EOS.strip_heredoc
::Kernel.warn <<-EOS.strip_heredoc
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 before_filter to your