I’ve made a survey in Rails where I want people to pick three words,
characteristics for different personality types, from a list of 30 words
for 20 different visual
details such as linear, organic, symmetry, etc.
I save each answer for each user, with the visual detail in one column
and the three words in an array in another column. E.g. for
Linear a user doing the survey might pick Word1,Word2,Word3.
What would be the best way to count Word1 picked for let’s say
Linearity? That is counting the occurrence.
One way would be:
Survey.count(:conditions => “details = ‘linear’ AND word like ‘Word1%’”)
But doing that for each of the 20 visual details and for each of the 30
words would mean a lot of queries. I suspect the answer is somehow to do
one search and then fix it with an array or hash method.
One last thing. My aim is to do something similar to tags that people
use on their blogs for most frequent key words which also is bigger in
font-size, if you know what I mean.