It''s not really clear to me what you''re trying to do, but
another option is
to use Marshal::dump and Marshal::load to store a binary representation of
the object into a BLOB column. That''s probably not a good idea if you
know
what type of object you want to store (if you know what the object looks
like, you should probably store it in the normal ActiveRecord way.) On the
other hand, using Marshal lets you store any object type- it''s more
flexible
but less clear, harder to support, and probably slower.
On 12/12/05, Rick Olson
<technoweenie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> On 12/12/05, Pat Maddox
<pergesu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > I don''t even know if this is possible. I want to use an
object as an
> > attribute for one of my classes. I can save it to the db fine, looks
> > like...but I need to be able to use it after I pull the object from
> > the db. Right now the attribute is just a String, but I need it to be
> > a Runt::Intersect object. Does anyone know how I can unserialize the
> > attribute so I can use it as an object?
>
> Check out ActiveRecord::Base.serialize:
> http://rails.rubyonrails.com/classes/ActiveRecord/Base.html#M000731
>
>
> --
> rick
> http://techno-weenie.net
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails