On 11 Dec 2008, at 16:05, Joe Peck wrote:

>
> Hullo.  Welcome to my question.
>
> In my controller I need to get the number of items in a table.
>
> If I was just using MySQL, I'd do "select count(*) from blah where  
> blah
> blah blah".
>
> What is the way to do this in my controller?  I'd like to avoid
> something like Blah.find(:all, :conditions => blah blah).size
>
Blah.count(:all, :conditions => ...)

or if you had a named_scope for that set of conditions,  
Blah.some_scope.count

Fred
> Is there a way to do the equivalent of select count(*) in the
> controller?
> -- 
> 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