I am trying to find a way to save arguments (*args) of a method in
database.
So that when retrieving values from database, coupled with the method
name, I would be able to go:
foo.send(method, *args)
Is it possible to use binary to save this args object?
Would there not be instantiation problems for arguments, so I would not
use the right object type when retrieving their values?
I could not find any similar process on the web. And I am not sure in
which direction to go…
Would there not be instantiation problems for arguments, so I would not
use the right object type when retrieving their values?
I’m not sure exactly what you’re asking. Perhaps you want
serialization of objects in text columns? Look at the docs for
ActiveRecord::Base, or Google “activerecord serialize”
If we understand you correctly you should serialize args to a database
field and desterilize it when needed.
You could use json format for this serialization/destabilization
purpose.
Anyhow, what ever formats you choose stay a way from binary one.
If we understand you correctly you should serialize args to a database
field and desterilize it when needed.
You could use json format for this serialization/destabilization
purpose.
Anyhow, what ever formats you choose stay a way from binary one.
Ok I’ll try to use that serialization.
Thanks for your help! This is what I was looking for.
Impressive the way “serialize :args” did all the work for me… whatever
type it is in the array when saving, it will give me the same one back
on deserialization.
Thanks for your great input.
Fred
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.