Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused/untested methods #424

Merged
merged 1 commit into from
Apr 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

Breaking changes

- None
- removed `audited_columns`, `non_audited_columns`, `auditing_enabled=` instance methods,
use class methods instead
[#424](https://github.com/collectiveidea/audited/pull/424)

Added

Expand Down
18 changes: 3 additions & 15 deletions lib/audited/auditor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def revision_at(date_or_time)

# List of attributes that are audited.
def audited_attributes
attributes.except(*non_audited_columns)
attributes.except(*self.class.non_audited_columns)
end

# Combine multiple audits into one.
Expand All @@ -159,14 +159,6 @@ def combine_audits(audits_to_combine)

protected

def non_audited_columns
self.class.non_audited_columns
end

def audited_columns
self.class.audited_columns
end

def revision_with(attributes)
dup.tap do |revision|
revision.id = id
Expand Down Expand Up @@ -202,9 +194,9 @@ def rails_below?(rails_version)
def audited_changes
all_changes = respond_to?(:changes_to_save) ? changes_to_save : changes
if audited_options[:only].present?
all_changes.slice(*audited_columns)
all_changes.slice(*self.class.audited_columns)
else
all_changes.except(*non_audited_columns)
all_changes.except(*self.class.non_audited_columns)
end
end

Expand Down Expand Up @@ -297,10 +289,6 @@ def run_conditional_check(condition, matching: true)
true
end

def auditing_enabled=(val)
self.class.auditing_enabled = val
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK with removing this method, but please add a line in the CHANGELOG file indicating this change and that the class method should be used instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


def reconstruct_attributes(audits)
attributes = {}
audits.each { |audit| attributes.merge!(audit.new_attributes) }
Expand Down