Skip to content

Commit

Permalink
Merge pull request #44 from optimalworkshop/platform/add-tablename
Browse files Browse the repository at this point in the history
add tablename to error message to make debugging easier
  • Loading branch information
lucy-dement authored Nov 1, 2023
2 parents ade39aa + cc6bcf7 commit 5cc2d69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deidentify.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = 'deidentify'
s.version = '2.6.0'
s.version = '2.6.1'
s.summary = 'Deidentify a rails model'
s.description = 'A gem to allow deidentification of certain fields'
s.authors = ['Lucy Dement']
Expand Down
4 changes: 3 additions & 1 deletion lib/deidentify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def recursive_deidentify!(validate:, deidentified_objects:)

def deidentify_column(column, config)
unless column_exists?(column)
Rails.logger.error "ERROR: Deidentification policy defined for #{column} but column doesn't exist"
Rails.logger.error(
"ERROR: Deidentification policy defined for #{column} but column doesn't exist in #{self.class.table_name}"
)
return
end

Expand Down
4 changes: 3 additions & 1 deletion spec/deidentify_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
end

it 'logs an error' do
expect(logger).to receive(:error).with("ERROR: Deidentification policy defined for oops but column doesn't exist")
expect(logger).to receive(:error).with(
"ERROR: Deidentification policy defined for oops but column doesn't exist in bubbles"
)

bubble.deidentify!
end
Expand Down

0 comments on commit 5cc2d69

Please sign in to comment.