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
>
> > Commune has 2 attributes: lattitude, longitude
>
> > ['acos(cos(:lattitude)*cos(entiteservices.commune.lattitue)*cos(entiteservi
> >ces.commune.longitude-:longitude)
> > +sin(:lattitude)*sin(entiteservices.commune.lattitude))*:r < :max',
> > {:lattitude => commune_usager_lat, :longitude =>
> > commune_usager_long,:r => 6378.138, :max => 10}]
> > end
> > end
>
> > But i am always getting an mysql error "Unknown column
> > 'entiteservices.commune.lattitue' " :
>
> The field is lattitude, not lattitue, and the table is communes,
> entiteservices.commune.lattitude is wrong, change all entiteservices.commune
> with communes, and lattitue with lattitude. You only have to set conditions as
> you would do in where clause of a sql query. Anyway, it's cleaner to use
> geokit plugin than put so much code in your controller
You're right the field is lattitude and i did the correction.
But the relation between Commune and Entiteservice is a many_to_one
relation:
And Commune has_many: entiteservices
Entiteservice belongs_to: commune
That's why i still get the following error: "Mysql::Error: Unknown
column 'entiteservices.communes.lattitude' in .... "
--
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.