Different implementation than Mongoid
iamnader opened this issue · comments
Nader Akhnoukh commented
In the latest Mongoid read_attribute for validation looks like this:
def read_attribute_for_validation(attr)
if relations[attr.to_s]
begin_validate
relation = send(attr)
exit_validate
relation.do_or_do_not(:in_memory) || relation
else
send(attr)
end
end
Yours looks like this:
def read_attribute_for_validation(key)
v = read_attribute(key)
v.try(:encrypted?) ? v.decrypt : v
end
Seems like you're changing the behavior, not just decrypting, right?
Junya Ogura commented
Thank you for your report.
I'm not watched mongoid repos recently, but I don't intend to change default behavior.
I'll create specs for this situation and update code.
Brian Meeker commented
For others looking at this issue, this fork seems to correct the behavior.