Bugs: Browse | Submit New | Admin
Hi guys, I get the following stack trace, I'm pretty sure my model is ok although I haven't finished the website yet and the model is very complex (lots of STI, polymorphism etc) so there _could_ be an issue with my modelling. Anyone seen this before? Ideas? Cheers, //matt /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/reflection.rb:244:in `source_reflection': You have a nil object when you didn't expect it! (NoMethodError) The error occurred while evaluating nil.klass from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/reflection.rb:244:in `collect' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/reflection.rb:244:in `source_reflection' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/reflection.rb:303:in `derive_class_name' from /usr/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/reflection.rb:107: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
Add A Comment:
Date: 2009-04-10 03:23 Sender: François Montel Likely a problem with your associations. This error is triggered when it can't find the associated class for a model. I ran into the same problem and after careful checking, found an error in my models. What I did was to take all my models out of the model folder, and then put them in one by one, running the railroad command each time. That allowed me to find the model that was triggering the error when then alerted me to the fact that I had an error in my associations.
Date: 2009-03-28 20:40 Sender: Bryan Woods I'm having this very same issue, did you find a fix? It's good to see you're using 2.2.2, since I was originally worried this error was an upgrade to 2.3.2 problem. I also am dealing with relatively complex polymorphism in my models, so I'm very intrigued by any workaround you might have found. Bryan