Find statement and ':group => ' udage

I have following statement in controller:

Sale.find(:all,:conditions => [“users.team_id IN (?)”,
Team.teams_ids(id)], :include => [:user], :group => “sales.stage_id”)

… but when looking to log the ‘group by’ is not generated in SQL
‘select’ statement so no grouping occures in resultset. Are there any
special conditions for using ‘:group’ in find statement?

Thanks,

David

David M. wrote:

I have following statement in controller:

Sale.find(:all,:conditions => [“users.team_id IN (?)”,
Team.teams_ids(id)], :include => [:user], :group => “sales.stage_id”)

… but when looking to log the ‘group by’ is not generated in SQL
‘select’ statement so no grouping occures in resultset. Are there any
special conditions for using ‘:group’ in find statement?

You can’t use :group if you also use :include. You can use :order,
if that’s what you intended.


We develop, watch us RoR, in numbers too big to ignore.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs