2008-12-29 138 views
1

對鐵路應用程序進行了一些修改後,我正在修補,鐵路停止工作。詳細輸出提供了一些線索。我想知道其他人是否遇到過這個問題,以及是否有解決這個問題的一些指針。這是一個數據建模錯誤?這是鐵路問題嗎?錯誤日誌如下...鐵路圖生成器失敗,出現「NoMethodError」

railroad -vM Loading application environment 
Loading application classes 
Generating models diagram 

...[snip]... 

    Processing Person 
     Processing model association authorships 
     Processing model association person_image 
     Processing model association publications 
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/reflection.rb:224:in `derive_class_name': You have a nil object when you didn't expect it! (NoMethodError) 
The error occurred while evaluating nil.class_name 
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/reflection.rb:106:in `class_name' 
    from /usr/lib/ruby/gems/1.8/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:134:in `process_association' 
    from /usr/lib/ruby/gems/1.8/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:102:in `process_class' 
    from /usr/lib/ruby/gems/1.8/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:101:in `each' 
    from /usr/lib/ruby/gems/1.8/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:101:in `process_class' 
    from /usr/lib/ruby/gems/1.8/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:27:in `generate' 
    from /usr/lib/ruby/gems/1.8/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:26:in `each' 
    from /usr/lib/ruby/gems/1.8/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:26:in `generate' 
    from /usr/lib/ruby/gems/1.8/gems/railroad-0.5.0/bin/railroad:47 
    from /usr/bin/railroad:19:in `load' 
    from /usr/bin/railroad:19 
+0

看起來像Person類的問題,你可以發佈代碼嗎? – 2008-12-29 12:10:19

回答

1

我想說你有一個流浪「的has_many」或「belongs_to的」或在您的Person模型等協會電話...

我猜你的模型看起來是像

class Person 
    has_many :authorships 
    has_many :images 
    has_many :publications 
    has_many #with nothing after it 
    # the rest 
end 
1

你可能有一個的has_many:通過協會,正確指定,像

人的has_many:出版物:通過=> ...:源=> ...

請確保你的源代碼在那裏!