ruby - How can I store a hash in my database? -



ruby - How can I store a hash in my database? -

is there ruby, or activerecord method can write , read hash , database field?

i need write web utility take post info , save database, later on pull database in original hash form. ideally without 'knowing' construction is. in other words, info store needs independent of particular set of hash keys.

for example, 1 time external app might post app:

"user" => "bill", "city" => "new york"

but time external app might post app:

"company" => "foo inc", "telephone" => "555-5555"

so utility needs save arbitrary hash text field in database, then, later, recreate hash saved.

you can utilize serialization 3 options: marshal in binary format, yaml , json human-readable formats of info store.

once trying each of methods, not forget measure time serialize , deserialize well. if need pull info in origin format, json selection use, because don't need deserialize it, utilize string itself.

ruby activerecord hash

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -