Array to String and back

I have data stored in an array and all elements are of the same type.

myarray = [1, 2, 3]

This data will be stored in a text column, array_as_string, of an

class Object < ActiveRecord::Base

So with an instance of Object, I save myarray by creating a
space-delimited string

myobject = => myarray.join(ā€™ '))

Updating is similar. I can then later retrieve the data by splitting
the string and converting the string data.

myotherarray = myobject.array_as_string.split.collect { |elem|
elem.to_i }

What Iā€™d like to know is there an easier and hopefully more automatic
way of doing this? Is there a helper that already exists to do this
and that may even detect the type of the element?