Is there any callback/hook for me to add some code to be called after all initializers (config/initializers/*) are called, in Rails 2? Or should I count on initializers being run in sort order and add one called zzzz_after_all_initializers.rb or something? Any advice? Jonathan -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 11 Nov 2008, at 18:07, Jonathan Rochkind wrote:> > Is there any callback/hook for me to add some code to be called after > all initializers (config/initializers/*) are called, in Rails 2? >config.after_initialize do ... end Fred> Or should I count on initializers being run in sort order and add one > called zzzz_after_all_initializers.rb or something? > > Any advice? > > Jonathan > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Frederick. But, documentation and googling that led me to source suggests that the after_initialize hook is called _before_ config/initializers are. http://dev.rubyonrails.org/browser/tags/rel_2-0-0_RC1/railties/lib/initializer.rb#L340 114 after_initialize 115 116 load_application_initializers Although I guess I''m looking at 2.0RC1 there. Not familiar enough with navigating svn to find the latest release, is there reason to believe this has changed? I guess I can monkey-patch Rails::process, with the aliasing-switcharoo trick, to first call the original Rails::process, and then call my own really_really_after_initializers method? Jonathan Frederick Cheung wrote:> On 11 Nov 2008, at 18:07, Jonathan Rochkind wrote: > >> >> Is there any callback/hook for me to add some code to be called after >> all initializers (config/initializers/*) are called, in Rails 2? >> > config.after_initialize do > ... > end > > Fred-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 11 Nov 2008, at 18:31, Jonathan Rochkind wrote:> > Thanks Frederick. But, documentation and googling that led me to > source > suggests that the after_initialize hook is called _before_ > config/initializers are. > > http://dev.rubyonrails.org/browser/tags/rel_2-0-0_RC1/railties/lib/initializer.rb#L340 > > 114 after_initialize > 115 > 116 load_application_initializers > > Although I guess I''m looking at 2.0RC1 there. Not familiar enough with > navigating svn to find the latest release, is there reason to believe > this has changed? >That was changed in 2.1 (which is what I looked at before i wrote my previous reply)> I guess I can monkey-patch Rails::process, with the aliasing- > switcharoo > trick, to first call the original Rails::process, and then call my own > really_really_after_initializers method? >sounds reasonable if you have to. Fred> Jonathan > > Frederick Cheung wrote: >> On 11 Nov 2008, at 18:07, Jonathan Rochkind wrote: >> >>> >>> Is there any callback/hook for me to add some code to be called >>> after >>> all initializers (config/initializers/*) are called, in Rails 2? >>> >> config.after_initialize do >> ... >> end >> >> Fred > > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Awesome, thank you, I''ll use 2.1 then, and count on the after_initialize hook really actually being after the initializers. Thanks for all your help, Fred. Jonathan Frederick Cheung wrote:> On 11 Nov 2008, at 18:31, Jonathan Rochkind wrote: > >> 116 load_application_initializers >> >> Although I guess I''m looking at 2.0RC1 there. Not familiar enough with >> navigating svn to find the latest release, is there reason to believe >> this has changed? >> > That was changed in 2.1 (which is what I looked at before i wrote my > previous reply) >> I guess I can monkey-patch Rails::process, with the aliasing- >> switcharoo >> trick, to first call the original Rails::process, and then call my own >> really_really_after_initializers method? >> > sounds reasonable if you have to. > > Fred-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---