Forum: Rails France 3 Models Has_many

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ba00a402965da738f601b6367cf3224f?d=identicon&s=25 Bolo Michelin (Guest)
on 2006-12-28 20:43
(Received via mailing list)

J'ai 3 models

class Pay < ActiveRecord::Base

   set_table_name "Pays"
   set_primary_key "CodePays"

   has_many :code_postaux, :class_name =>
"CodesPostaux", :foreign_key => "CodePays"
   has_many  :zones,
             :class_name => "ZonesGraphique",
             :foreign_key => "CodePays"

class ZonesGraphique < ActiveRecord::Base

   set_primary_key "IDZoneGeographique"
   set_table_name "ZonesGraphiques"

   belongs_to :pay, :class_name => "Pay", :foreign_key => "CodePays"

   has_many :distributeurs,
            :class_name => "Distributeur",
            :select => "DISTINCT IDCodePostal",
            :foreign_key => "IDZoneGeographique"

class Distributeur < ActiveRecord::Base
    set_table_name "Expay_Distributeurs"
    set_primary_key "IDDistributeur"

    belongs_to :code_postal, :class_name =>
"CodesPostaux", :foreign_key => "IDCodePostal"
    belongs_to :zone_geo, :class_name =>
"ZonesGraphique", :foreign_key => "IDZoneGeographique"

J'aimerais afficher par pays toutes les zones qui ont des
distributeurs. Mais je bloque

Un tit coup de main :)


Bolo Michelin
This topic is locked and can not be replied to.