> > On 6 mai, 12:34, "Sergio Cambra .:: entreCables S.L. ::."
>
> > <[email protected]> wrote:
> > > > I have the following associations with 3 classes: Commune,
> > > > Entiteservice, Offreservice
> > > > class Commune < ActiveRecord::Base
> > > > end
>

> There is no table entiteservices.communes, but in the query there is a table
> communes, which is the table with lattitude and longitude columns.

   There is no table entiteservices.communes, but there is a table
entiteservices.commune.

   The lattitude and longitude columns are for the Commune table.

> That table is joined with communes_offreservices, which is the table for the 
> habtm between
> offreservices and communes.
>
  The table for the habtm between offreservices and communes is
communes_offreservices.
  So i wanted to delete this association between communes and
offreservices and only use the entiteservices.commune.lattitude and
entiteservices.commune.longitude values for distances calculation.

> Check the SQL in log.
>
Here is the SQL in log file:

ActiveRecord::StatementInvalid (Mysql::Error: Unknown column
'entiteservices.commune.lattitude' in 'where clause': SELECT
count(DISTINCT `offreservices`.id) AS count_all FROM `offreservices`
LEFT OUTER JOIN `entiteservices_offreservices` ON
`entiteservices_offreservices`.offreservice_id = `offreservices`.id
LEFT OUTER JOIN `entiteservices` ON `entiteservices`.id =
`entiteservices_offreservices`.entiteservice_id  LEFT OUTER JOIN
`offreservices_services` ON `offreservices_services`.offreservice_id =
`offreservices`.id  LEFT OUTER JOIN `services` ON `services`.id =
`offreservices_services`.service_id  LEFT OUTER JOIN `horaires` ON
horaires.offreservice_id = offreservices.id WHERE
((acos(cos(0.79309216894474)*cos(entiteservices.commune.lattitude)*cos(entiteservices.commune.longitude
-
0.076619951832285)+sin(0.79309216894474)*sin(entiteservices.commune.lattitude))*6378.138
< 10)) ):

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.

Reply via email to