On Feb 1, 2008, at 9:41 PM, Rick Olson wrote:

> I want to shuffle things around so that routes and observers are
> loaded last, after plugins, the after_initialize callbacks, and the
> application initializers.  Here's the problem:
>
> 1) I add a gem (has_finder) to a file in config/initializers
> 2) It is used in my User model
> 3) AR initializes my UserObserver model, which loads User, before the
> config/initializers run
> 4) BOOM, undefined method #has_finder
>
> This issue is easily worked around, but this small change in the load
> order makes sense to me.
>
> http://dev.rubyonrails.org/attachment/ticket/10980/load_order.diff

+1

Instantiating an observer triggers loading its observed model class to  
register it, and I think the model class should be allowed to expect  
full initialization. Particularly we are concerned here with  
extensions to Active Record by plugins or initializers.

If you happen to be creating observed models in config/initializers  
you can still manually instantiate the singleton. So there's some  
price here, but you still have a simple solution, and I believe the  
use cases above are far more important.

I've added a documentation patch:

    
http://dev.rubyonrails.org/attachment/ticket/10980/document_observers_loading.diff

-- fxn


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to