I need some help with a calculation in a survey that I run.

I have one table with words, characteristics, such as "careful,
dominant, positive" etc.

People are then to select the words they think belong to a visual
detail, such as a square, circle, symmetry, etc. They can select 1-3
words.

These are then stored in one string field, as a string with space
between each word, in the table used for answers. So each visual detail
gets its own row with this "word field".

What is the best way to count how many that have selected one of the
words for a particular visual detail, e.g how many have selected "hard"
for a square?

I could collect the words in one find and then use count for each, but
that will be many searches, so I figured I could do one search only in
the answers table, and then loop through it and check how often the word
is selected. But I'm not sure how to do that. I'm thinking of some
functions in Array that I could use, or..?

Hopefully you understand the setup and my need. Any ideas?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to