Ramon Miguel M. Tayag
2008-Sep-20 10:22 UTC
Observer doesn''t work properly... in development?
Hey all! Ok, weird problem with observer. Most of the time, the after_create of UserObserver isn''t called. It''s like it just skips it altogether. However, when I stop the server, add a line "debugger" in the after_create block, and restart the server with the debugger option, and try creating a user again, the callback is executed! If I remove the debugger in the block and restart the server, it''s back to ignoring it. Another thing, if I leave the debugger line in the after_create block, but restart the server _without_ the debugger option, when I create a user I see in the logs: ***** Debugger requested, but was not available: Start server with --debugger to enable ***** So, it tells me that it somewhat enters the after_create method but doesn''t execute my BackgroundRB Middleman job? Anyone else see this behavior before? I asked around in #rubyonrails in freenode and someone mentioned that it might be because I''m running it in development mode. He vaguely remembers a way to run observers properly. I want it to run in development too, of course. Funny thing is, as far as I can tell, my after_save methods are always called. I hope you guys can help. Thanks! -- Ramon Tayag --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ramon Miguel M. Tayag
2008-Sep-20 10:53 UTC
Re: Observer doesn''t work properly... in development?
I transferred the callback to the model, and it seems that it''s the same problem. I think the problem lies in BackgroundRB then, not Rails or the observer. Thanks for reading my previous mail though! Off to the backgroundrb mailing list. On Sat, Sep 20, 2008 at 6:22 PM, Ramon Miguel M. Tayag <ramon.tayag-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey all! > > Ok, weird problem with observer. Most of the time, the after_create > of UserObserver isn''t called. It''s like it just skips it altogether. > However, when I stop the server, add a line "debugger" in the > after_create block, and restart the server with the debugger option, > and try creating a user again, the callback is executed! If I remove > the debugger in the block and restart the server, it''s back to > ignoring it. Another thing, if I leave the debugger line in the > after_create block, but restart the server _without_ the debugger > option, when I create a user I see in the logs: > > ***** Debugger requested, but was not available: Start server with > --debugger to enable ***** > > So, it tells me that it somewhat enters the after_create method but > doesn''t execute my BackgroundRB Middleman job? > > Anyone else see this behavior before? > > I asked around in #rubyonrails in freenode and someone mentioned that > it might be because I''m running it in development mode. He vaguely > remembers a way to run observers properly. I want it to run in > development too, of course. Funny thing is, as far as I can tell, my > after_save methods are always called. > > I hope you guys can help. > > Thanks! > -- > Ramon Tayag >-- Ramon Tayag --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Conrad Taylor
2008-Sep-20 11:34 UTC
Re: Observer doesn''t work properly... in development?
On Sat, Sep 20, 2008 at 3:53 AM, Ramon Miguel M. Tayag < ramon.tayag-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I transferred the callback to the model, and it seems that it''s the > same problem. I think the problem lies in BackgroundRB then, not > Rails or the observer. Thanks for reading my previous mail though! > Off to the backgroundrb mailing list. > > On Sat, Sep 20, 2008 at 6:22 PM, Ramon Miguel M. Tayag > <ramon.tayag-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hey all! > > > > Ok, weird problem with observer. Most of the time, the after_create > > of UserObserver isn''t called. It''s like it just skips it altogether. > > However, when I stop the server, add a line "debugger" in the > > after_create block, and restart the server with the debugger option, > > and try creating a user again, the callback is executed! If I remove > > the debugger in the block and restart the server, it''s back to > > ignoring it. Another thing, if I leave the debugger line in the > > after_create block, but restart the server _without_ the debugger > > option, when I create a user I see in the logs: > > > > ***** Debugger requested, but was not available: Start server with > > --debugger to enable ***** > > > > So, it tells me that it somewhat enters the after_create method but > > doesn''t execute my BackgroundRB Middleman job? > > > > Anyone else see this behavior before? > > > > I asked around in #rubyonrails in freenode and someone mentioned that > > it might be because I''m running it in development mode. He vaguely > > remembers a way to run observers properly. I want it to run in > > development too, of course. Funny thing is, as far as I can tell, my > > after_save methods are always called. > > > > I hope you guys can help. > > > > Thanks! > > -- > > Ramon Tayag > > >Hi Ramon, I would recommend creating an environment file called staging.rb by doing the following: cd <RAILS_APP_ROOT>/config/environments cp production.rd staging.rb Next, you''ll need to create staging section within your database.yml located in cd <RAILS_APP_ROOT>/config cd <RAILS_APP_ROOT> script/server staging In short, your staging environment will be used to mimic the actual production environment without hitting the production server. You don''t really want to start changing the development.rb to work like the production.rb. Good luck, -Conard --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ramon Miguel M. Tayag
2008-Sep-21 10:36 UTC
Re: Observer doesn''t work properly... in development?
Thanks conrad this''ll be useful :) On Sat, Sep 20, 2008 at 7:34 PM, Conrad Taylor <conradwt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sat, Sep 20, 2008 at 3:53 AM, Ramon Miguel M. Tayag > <ramon.tayag-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> I transferred the callback to the model, and it seems that it''s the >> same problem. I think the problem lies in BackgroundRB then, not >> Rails or the observer. Thanks for reading my previous mail though! >> Off to the backgroundrb mailing list. >> >> On Sat, Sep 20, 2008 at 6:22 PM, Ramon Miguel M. Tayag >> <ramon.tayag-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > Hey all! >> > >> > Ok, weird problem with observer. Most of the time, the after_create >> > of UserObserver isn''t called. It''s like it just skips it altogether. >> > However, when I stop the server, add a line "debugger" in the >> > after_create block, and restart the server with the debugger option, >> > and try creating a user again, the callback is executed! If I remove >> > the debugger in the block and restart the server, it''s back to >> > ignoring it. Another thing, if I leave the debugger line in the >> > after_create block, but restart the server _without_ the debugger >> > option, when I create a user I see in the logs: >> > >> > ***** Debugger requested, but was not available: Start server with >> > --debugger to enable ***** >> > >> > So, it tells me that it somewhat enters the after_create method but >> > doesn''t execute my BackgroundRB Middleman job? >> > >> > Anyone else see this behavior before? >> > >> > I asked around in #rubyonrails in freenode and someone mentioned that >> > it might be because I''m running it in development mode. He vaguely >> > remembers a way to run observers properly. I want it to run in >> > development too, of course. Funny thing is, as far as I can tell, my >> > after_save methods are always called. >> > >> > I hope you guys can help. >> > >> > Thanks! >> > -- >> > Ramon Tayag >> > > > Hi Ramon, I would recommend creating an environment file called staging.rb > by doing the following: > cd <RAILS_APP_ROOT>/config/environments > cp production.rd staging.rb > Next, you''ll need to create staging section within your database.yml located > in cd <RAILS_APP_ROOT>/config > cd <RAILS_APP_ROOT> > script/server staging > In short, your staging environment will be used to mimic the actual > production environment without hitting the > production server. You don''t really want to start changing the > development.rb to work like the production.rb. > Good luck, > -Conard > > > >-- Ramon Tayag --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---