Link to home
Start Free TrialLog in
Avatar of singsunn
singsunn

asked on

Rails 3.0 Routing

What is the Rails 3 Equivalent of this Rails 2 Route.

Team.count(
                  :joins => "INNER JOIN media on media_rep.id = media.media_rep_id"
                  :conditions => ["user_id = #{user_id} "],
                  :order => 'created_at DESC'
                )

Open in new window

Avatar of WizardOfOgz
WizardOfOgz

Whoops, that isn't a route.

You can use the above code in Rails 3.  The :order => 'created_at DESC' does nothing to affect the count, however, so you can remove it.
Avatar of singsunn

ASKER

whoops .. what was i thinking .. i didnt mean to call it routes? but how do i rewrite this activerecord query ?

cause the one above gives me an error..
I could do something like  
Team.joins(".....").where("...") 

Open in new window

This would give me the whole resultset.. but i just need the count.
ASKER CERTIFIED SOLUTION
Avatar of WizardOfOgz
WizardOfOgz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial