juno / mongoid-encryptor

[OBSOLETE] mongoid-encryptor encrypts and decrypts one or more fields in a Mongoid model.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different implementation than Mongoid

iamnader opened this issue · 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?

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.

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