mongoid-encryptor icon indicating copy to clipboard operation
mongoid-encryptor copied to clipboard

Different implementation than Mongoid

Open iamnader opened this issue 13 years ago • 2 comments

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?

iamnader avatar Nov 18 '11 23:11 iamnader

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.

juno avatar Dec 02 '11 09:12 juno

For others looking at this issue, this fork seems to correct the behavior.

CuriousCurmudgeon avatar Sep 19 '12 03:09 CuriousCurmudgeon