How to make an ActiveRecord::Base object to have a list of strings?


I'm new to Rails and already did some stuff with ActiveRecord associations but I cannot do one thing:

I've got a

This won't answer your question but I hope it helps you because your approach sounds too complicated to me, unless it is just for playing and learning. Why would you want to store each word in a record in a table? What if a word belongs to more than one paragraph?

How about hiding the “ugly” code on a to_simplified_json method in your Paragraph model?

@pepe: Yeah, one word could belong to many paragraphs but it was actually more for experimentation purposes. With Hibernate in Java one could use annotations like @Embedded to achieve something similar so I wanted to compare Hibernate and ActiveRecord but in reality, you're right, it is a bit too complicated (:

@Erol Yep, I guess I'll end up doing just that (: Just wondered if there is something neater to do.

Thank you, Martin


serialize :words, Array

what you are looking for ?


I guess I can use that. Thank you!


Serialize ? What do that ?

Matias Fierro wrote in post #956786:

Serialize ? What do that ?

It does exactly what the docs say it does.