How do I set variables dynamically based on a search in the database? I
have a list of 30 words in a table called 'words' with a field
called...words. I would like to loop through them and for each word set
a variable. But I'm not sure how to do that. I've tried this but get an
error:
@thewordlist = Word.find(:all)
if @thewordlist
@thewordlist.each do |w|
"@" + w.word = Publicsurvey.count(:conditions => ["word LIKE
?", w.word])
end
end
How should I do this?
--
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
-~----------~----~----~----~------~----~------~--~---