Find (ordering by field in related table)

Hi,

I am using the rails find command as below

@project_pages, @projects = paginate :projects, :per_page => 20,
:conditions => "clients.organisation_id = " +
params[‘search’][‘organisation_id’],
:joins => ‘inner join clients ON clients.id = projects.client_id’

There seems to be a problem with project.id being over written with
project.client.id.

Any suggestions to whats going wrong?

Thanks
scott

solved by doing

@project_pages, @projects = paginate :projects, :per_page => 20,
:conditions => "clients.organisation_id = " +
params[‘search’][‘organisation_id’],
:include => [:client]

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