From 366e0e26b7e468c6c15f9e5cc094935608b6e132 Mon Sep 17 00:00:00 2001 From: Tomer Brisker Date: Tue, 9 Jan 2018 22:07:22 +0200 Subject: [PATCH] Fix duplicate decleration warnings --- CHANGELOG.md | 2 ++ lib/audited.rb | 5 +++-- spec/spec_helper.rb | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 036d80fa6..b1619efd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,8 @@ Fixed [#390](https://github.com/collectiveidea/audited/pull/390) - Passing an invalid version to `revision` returns `nil` instead of last version [#384](https://github.com/collectiveidea/audited/pull/384) +- Fix duplicate deceleration warnings + [#398](https://github.com/collectiveidea/audited/pull/398) ## 4.5.0 (2017-05-22) diff --git a/lib/audited.rb b/lib/audited.rb index b54fa0350..eaf34cb99 100644 --- a/lib/audited.rb +++ b/lib/audited.rb @@ -2,10 +2,11 @@ module Audited class << self - attr_accessor :ignored_attributes, :current_user_method, :audit_class + attr_accessor :ignored_attributes, :current_user_method + attr_writer :audit_class def audit_class - @audit_class || Audit + @audit_class ||= Audit end def store diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 025f14d37..a13513ea0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,7 +9,6 @@ require 'audited' require 'audited_spec_helpers' require 'support/active_record/models' -load "audited/sweeper.rb" # force to reload sweeper SPEC_ROOT = Pathname.new(File.expand_path('../', __FILE__))