forked from rails/rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
book_encrypted.rb
58 lines (41 loc) · 1.44 KB
/
book_encrypted.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# frozen_string_literal: true
class UnencryptedBook < ActiveRecord::Base
self.table_name = "encrypted_books"
end
class EncryptedBook < ActiveRecord::Base
self.table_name = "encrypted_books"
encrypts :name, deterministic: true
end
class EncryptedBookWithUniquenessValidation < ActiveRecord::Base
self.table_name = "encrypted_books"
validates :name, uniqueness: true
encrypts :name, deterministic: true
end
class EncryptedBookWithDowncaseName < ActiveRecord::Base
self.table_name = "encrypted_books"
validates :name, uniqueness: true
encrypts :name, deterministic: true, downcase: true
end
class EncryptedBookThatIgnoresCase < ActiveRecord::Base
self.table_name = "encrypted_books"
encrypts :name, deterministic: true, ignore_case: true
end
class EncryptedBookWithUnencryptedDataOptedOut < ActiveRecord::Base
self.table_name = "encrypted_books"
validates :name, uniqueness: true
encrypts :name, deterministic: true, support_unencrypted_data: false
end
class EncryptedBookWithUnencryptedDataOptedIn < ActiveRecord::Base
self.table_name = "encrypted_books"
validates :name, uniqueness: true
encrypts :name, deterministic: true, support_unencrypted_data: true
end
class EncryptedBookWithBinary < ActiveRecord::Base
self.table_name = "encrypted_books"
encrypts :logo
end
class EncryptedBookWithSerializedBinary < ActiveRecord::Base
self.table_name = "encrypted_books"
serialize :logo, coder: JSON
encrypts :logo
end