Forum: Rails France 3 Models Has_many

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community 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)
Bonjour,

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"
end

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"
end

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"
end

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

Un tit coup de main :)

Merci


Bolo Michelin
malavoi@gmail.com
http://blog.developpez.com/index.php?blog=30
This topic is locked and can not be replied to.