Skip to content

Commit 6eb4ee4

Browse files
jorgemanrubiahahmed
andcommitted
Encryption scheme is commong (no need to instantiate 1 per attribute)
See rails#43009 (comment) Remove `table_exists?` check that became unnecessary after rails#43009 Co-authored-by: Haroon Ahmed <[email protected]>
1 parent 24f2502 commit 6eb4ee4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

activerecord/lib/active_record/encryption/encryptable_record.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ module EncryptableRecord
4646
# encryption is used, they will be used to generate additional ciphertexts to check in the queries.
4747
def encrypts(*names, key_provider: nil, key: nil, deterministic: false, downcase: false, ignore_case: false, previous: [], **context_properties)
4848
self.encrypted_attributes ||= Set.new # not using :default because the instance would be shared across classes
49+
scheme = scheme_for key_provider: key_provider, key: key, deterministic: deterministic, downcase: downcase, \
50+
ignore_case: ignore_case, previous: previous, **context_properties
4951

5052
names.each do |name|
51-
scheme = scheme_for key_provider: key_provider, key: key, deterministic: deterministic, downcase: downcase, \
52-
ignore_case: ignore_case, previous: previous, **context_properties
5353
encrypt_attribute name, scheme
5454
end
5555
end

0 commit comments

Comments
 (0)