Rob Biedenharn wrote:
> On Dec 18, 2008, at 4:40 PM, P�l Bergstr�m wrote:

> 
> Then you can process the @word_counts hash however you like.
> 
> sql = <<-END
>    SELECT words.word, count(publicsurveys.id) as 'count'
>    FROM words LEFT OUTER JOIN publicsurveys ON publicsurvey.word =
> words.word
>    GROUP BY words.word
> END
> 
> @word_counts = {}
> Word.connection.select_all(sql).each {|rowhash|
> @word_counts[rowhash['word']] = rowhash['count']}
>


Perfect :-)
-- 
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