I have a model called Encryption which generates an AES encrypted string and saves that to a database table called encryptions. My encryption table schema is as follows:
id : bigint unsigned
user_id : bigint unsigned
encryption : VARCHAR(128) (utf8_unicode_ci)
created_at : datetime
updated_at : datetime
However, when I call .save on my encryption model instance, the value for encryption.encryption (in the database) is blank ('').
Here's the contents of the model:
ruby-1.9.2-head :005 > encryption
=> #<Encryption id: nil, user_id: 1, encryption: "\xD6\xD6\x95\x15\x0F\x92\xC6\x01\x86\x1E\x88\xD1\xB0\x1D\xE0\xEC", created_at: nil, updated_at: nil>
As you can see, it does have a value in the model. Any ideas on why the field is saving as blank in the database?
I'm using the strongbox gem to do something similar, and it requested a column type of :binary
, not text, maybe you could try that...