I think this is the dreaded stale-class bug. e.g. say you have a model  
class Product, in dev mode, on every request that class is re-created.  
i.e. there's a brand new class object (Product.object_id will be  
different). If you store a reference to a class any place that  
survives from one request to the next (e.g. in the session, a class  
variable on some class that is not reloaded...) you will actually have  
two distinct versions of that class in you app at the same time, which  
causes all sorts of pain.

Is there somewhere you are storing a class object? If you need to  
store a reference to a class, a simple fix is to store the name, and  
then do class_name.constantize to get the class back again (that will  
get you the latest reloaded version)

Unfortunately these are very hard to track down...

Tom


On 4 Nov 2008, at 23:05, adamski wrote:

>
> I just started getting a weird error from Hobo.add_routes, in
> routes.rb.
>
> I can load up one page of my app but then any other page brings up the
> error below, till I restart Mongrel.
> If I remove Hobo.add_routes it works. But without Hobo routes :-(
>
> Never had this problem and I have no idea why it started, I've not
> done anything to the app since it last worked!!
> Any help much appreciated.
>
> Thx
>
> NoMethodError (You have a nil object when you didn't expect it!
> You might have expected an instance of Array.
> The error occurred while evaluating nil.*):
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/dryml/
> dryml_generator.rb:186:in `standard_fields'
>    rapid/forms:3:in `run_one'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/dryml/
> dryml_generator.rb:105:in `each_controller'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/dryml/
> dryml_generator.rb:103:in `each'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/dryml/
> dryml_generator.rb:103:in `each_controller'
>    rapid/forms:1:in `run_one'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/dryml/
> dryml_generator.rb:52:in `run_for_subsite'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/dryml/
> dryml_generator.rb:51:in `each_pair'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/dryml/
> dryml_generator.rb:51:in `run_for_subsite'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/dryml/
> dryml_generator.rb:45:in `run'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/dryml/
> dryml_generator.rb:45:in `each'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/dryml/
> dryml_generator.rb:45:in `run'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/dryml/
> dryml_generator.rb:17:in `run'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo/model_router.rb:
> 85:in `add_routes'
>    /usr/lib/ruby/gems/1.8/gems/hobo-0.8.3/lib/hobo.rb:120:in
> `add_routes'
>    /config/routes.rb:7
>   ....
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to