Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10980 (closed defect: fixed)

Opened 10 months ago

Last modified 10 months ago

[PATCH] shuffle application load order, load routes/observers last

Reported by: technoweenie Assigned to: technoweenie
Priority: normal Milestone: 2.x
Component: Railties Version: edge
Severity: normal Keywords:
Cc:

Description

I'm proposing we shuffle the application load order so that routes and observers are loaded last. See discussion on rails-core ML...

Attachments

load_order.diff (0.8 kB) - added by technoweenie on 02/01/08 20:31:57.
document_observers_loading.diff (1.1 kB) - added by fxn on 02/02/08 08:01:54.

Change History

02/01/08 20:31:57 changed by technoweenie

  • attachment load_order.diff added.

02/02/08 00:35:35 changed by thewoolleyman

+1

Looks reasonable. "Initializer" seems like it should happen before other stuff, like observers - even if it breaks somebody somewhere.

02/02/08 08:01:54 changed by fxn

  • attachment document_observers_loading.diff added.

02/02/08 08:17:08 changed by fxn

+1

Quoting my reply in the ML:

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.

02/02/08 20:12:16 changed by technoweenie

  • owner changed from core to technoweenie.
  • status changed from new to assigned.

Good docs, except that observers are loaded between plugins and app initializers.

02/02/08 20:18:21 changed by rick

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [8787]) Reshuffle load order so that routes and observers are initialized after plugins and app initializers. Closes #10980 [rick, fxn]

02/02/08 21:43:25 changed by fxn

Oh yes, sorry for the lapse, thank you for the fix.