Maybe this question is obvious, but I'm missing the answer. I want one of the fields in my model to be an array of int. These are not indexes into another model. I'm cool with creating another database table if I have to, but then do I need to do a join to access the data? Or does Ruby have some cool trick where I can translate my array of ints into a String, store it in a single field, and then be smart enough that when I pull it back out I can convert it back into an array so nobody's the wiser? (I'm sure I can do this and be kludgy about it, I'm wondering if there's something already built in that might mean I can do it invisibly). Thanks!
on 2006-06-02 17:37
on 2006-06-02 19:08
On Friday, June 02, 2006, at 3:37 PM, Duane M. wrote: > >Thanks! > >-- >Posted via http://www.ruby-forum.com/. >_______________________________________________ >Rails mailing list >firstname.lastname@example.org >http://lists.rubyonrails.org/mailman/listinfo/rails in your model definition, you can do this.. def model serialize :some_array end Just make sure the column in the database can hold the serialized object. Probably 'text' or bigger. _Kevin
on 2006-06-02 20:33
Kevin O. wrote: > serialize :some_array Perfect! Thanks Kevin. And now that I know the word to google for I see many obvious examples, including in the documentation for ActiveRecord itself :)