Skip to content

Commit

Permalink
Removed lockbox_encrypts (use has_encrypted instead)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Oct 26, 2024
1 parent fefa57c commit 9c84fd3
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.0.0 (unreleased)

- Improved `attributes`, `attribute_names`, and `has_attribute?` when ciphertext attributes not loaded
- Removed `lockbox_encrypts` (use `has_encrypted` instead)
- Dropped support for Active Record < 7 and Ruby < 3.1
- Dropped support for Mongoid < 8

Expand Down
6 changes: 0 additions & 6 deletions lib/lockbox/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -724,12 +724,6 @@ def reload
end
end

def lockbox_encrypts(*attributes, **options)
deprecator = ActiveSupport::VERSION::STRING.to_f >= 7.2 ? ActiveSupport.deprecator : ActiveSupport::Deprecation
deprecator.warn("`#{__callee__}` is deprecated in favor of `has_encrypted`")
has_encrypted(*attributes, **options)
end

module Attached
def encrypts_attached(*attributes, **options)
attributes.each do |name|
Expand Down
13 changes: 0 additions & 13 deletions test/model_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -783,19 +783,6 @@ def test_encrypts_no_attributes
assert_equal "No attributes specified", error.message
end

def test_lockbox_encrypts_deprecated
assert_output(nil, /DEPRECATION WARNING: `lockbox_encrypts` is deprecated in favor of `has_encrypted`/) do
Admin.lockbox_encrypts :dep
end
end

def test_encrypts_deprecated
skip if !mongoid?
assert_output(nil, /DEPRECATION WARNING: `encrypts` is deprecated in favor of `has_encrypted`/) do
Admin.encrypts :dep2
end
end

private

def assert_no_plaintext_attributes
Expand Down

0 comments on commit 9c84fd3

Please sign in to comment.