Problème de dépendence circulaire?


#1

Bonjour,

Je suis sous rails 1.0
J’ai l’impression de tomber sur un problème de dépendence circulaire que
je n’arrive pas a résoudre, que faire ? :slight_smile:

Voici mes modèles

class Customer < ActiveRecord::Base
has_and_belongs_to_many :projects
end

class Project < ActiveRecord::Base
has_and_belongs_to_many :customers
end

Customer.count ne marche et me pond l’erreur suivante:

e:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:207:in
load' e:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:207:inload’
e:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:39:in
require_or_load' e:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:22:independ_on’
e:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:30:in
associate_with' e:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:179:inrequire_association’
e:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:179:in
require_association' e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/associations.rb:780:inrequire_association_class’
e:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/associations.rb:650:in
has_and_belongs_to_many_without_reflection' (eval):5:inhas_and_belongs_to_many’
#{RAILS_ROOT}/app/models/customer.rb:2
#{RAILS_ROOT}/app/views/search/test.rhtml:1
-e:3:in `load’
-e:3