Hi all, I want Rails to execute some code when starting the server, just at the beginning. I can add code to environment.rb; however, if this code makes reference to the classes in app/models/, an exception appears, cause that classes are not loaded before environment.rb is. So, how and where can I set an initial code involving the classes in app/models of my app? Thanks. -- 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 -~----------~----~----~----~------~----~------~--~---
2008/7/3 Damaris Fuentes <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Hi all, > > I want Rails to execute some code when starting the server, just at the > beginning. > I can add code to environment.rb; however, if this code makes reference > to the classes in app/models/, an exception appears, cause that classes > are not loaded before environment.rb is. > > So, how and where can I set an initial code involving the classes in > app/models of my app?Have you tried setting up some initializer at config/initializers ? -- Raul Murciano - Freelance Web Developer http://raul.murciano.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
No, I didn''t try (didn''t know that). I''ve put some code now and it works, lots of thanks :) Raul Murciano wrote:> 2008/7/3 Damaris Fuentes <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>: >> app/models of my app? > Have you tried setting up some initializer at config/initializers ? > > -- > Raul Murciano - Freelance Web Developer > http://raul.murciano.net-- 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 -~----------~----~----~----~------~----~------~--~---