Jay Covington wrote:
[...]
> item_ids = 1..5
> statcount_query = item_ids.map{|id| "item#{id} = BLANK "}.join(" OR
> ")
> @statcount = table.count(:all, :conditions => statcount_query).to_s
Well, first of all, you can forget about the map statement and put the
array item_ids straight into :conditions -- Rails will understand it.
But that won't get you what you need, because it will just return a
total count of all the items that match *any* ID. I think you need to
use :group here.
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
--
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
-~----------~----~----~----~------~----~------~--~---