hope the title's pretty self-explanatory.
I'm using mongoid
as my ORM for a Rails app, and I was wondering if anybody knew if it has an equivalent to ActiveRecord's serialize
method. I've looked through the mongoid documentation but haven't been able to find anything yet.
Here's an example of the model:
class Foo
include Mongoid::Document
field :params, type: String
serialize :params # method from ActiveRecord
end
Thanks in advance!
You don't need to serialize with MongoDB as far as you can store in fields Arrays and Hashes.
field :hash_params, type: Hash
field :array_params, type: Array
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With