Skip to content

Commit 17ff856

Browse files
committed
Binary type for attribute was getting override to Value type for 5.1 due to this.
1 parent 3a9dfc7 commit 17ff856

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/attr_encrypted/adapters/active_record.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ def attr_encrypted(*attrs)
5151
super
5252
options = attrs.extract_options!
5353
attr = attrs.pop
54-
attribute attr if ::ActiveRecord::VERSION::STRING >= "5.1.0"
54+
if ::ActiveRecord::VERSION::STRING >= "5.1.0"
55+
column_type = columns_hash[attr.to_s].type unless columns_hash[attr.to_s].nil?
56+
column_type.nil? ? attribute(attr) : attribute(attr, column_type)
57+
end
5558
options.merge! encrypted_attributes[attr]
5659

5760
define_method("#{attr}_was") do

0 commit comments

Comments
 (0)