Skip to content

Commit

Permalink
Use ::Kernel.warn instead of implicit receiver warn
Browse files Browse the repository at this point in the history
Some people override warn in their applications. Using an explicit
receiver protects against this.

[Fixes paper-trail-gem#791]
  • Loading branch information
jaredbeck committed May 4, 2016
1 parent ad0a7d7 commit 99ccfd7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/paper_trail/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def self.next_migration_number(dirname)
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
Expand Down
2 changes: 1 addition & 1 deletion lib/paper_trail/frameworks/rails/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def warn_about_not_setting_whodunnit
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
Expand Down

0 comments on commit 99ccfd7

Please sign in to comment.