Skip to content

Conversation

@jondavidschober
Copy link

No description provided.

@atyndall
Copy link
Contributor

Hi @Littlejd1997, thanks for your contribution.
Could you provide a code example of the bug your PR aims to fix?
And with your new JSON feature, could you explain the rationale behind the feature, and how your changes enable that feature?

@jondavidschober
Copy link
Author

An error would occur if no explicit configuration was used.

The second json feature was for encrypting fields which were formerly jsonb columns in a postgres db. Basically, if a hash is passed in, then its converted to json and then encrypted and stored. Likewise, if it can parse json, it will parse it and return a hash on decryption

@jondavidschober
Copy link
Author

Also, I was getting a "must exist to store encrypted data" error when running some of our older migrations before the enc field was created and our migrations would fail

@atyndall
Copy link
Contributor

With your JSON feature, if you enable Data Serialization (described here) then high level data structures should already be encoding and decoded transparently by the msgpack library. Does your proposed feature differ in function from this?

With your "must exist to store encrypted data" error, I can see why that might occur, it might make more sense to not just comment it out, but move the validation to inside the define_method "#{field}=" and define_method "#{field}" methods.

@jondavidschober
Copy link
Author

I added another commit. I change the .nil? check to .blank? which would include empty strings. Currently, empty strings causes openss(?)l to throw an error ArgumentError: data must not be empty

@atyndall
Copy link
Contributor

Thanks, I'll have a look into it Monday. Do you have a reply to my questions above?

@atyndall
Copy link
Contributor

I've addressed the bugs you've reported, please let me know about that JSON issue if it continues to be one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants