On Friday, November 22, 2013 7:48:18 AM UTC, Colin Law wrote:
>
> On 22 November 2013 05:15, Greg Willits <[email protected]<javascript:>> 
> wrote: 
> > 
> > The problem I am seeing is that global_logger is being run only one 
> > time. In all my previous versions (as a Rails 2 plugin, and a Rails 3 
> > gem) that class method runs from scratch every page load and I count on 
> > that behavior to do some things. In this new Rails 4 setup, it is 
> > running the first time and that's it. The rest of my logger code 
> > (writing messages from subsequent controllers) seems to work fine. 
>
> I am sure you are mistaken.  That code will only be interpreted when 
> the class is loaded (which, by default, in development mode will be at 
> every action, but in production will only be when the server is 
> started). That is true in Rails 3 and Rails 4.  Try putting a puts 
> statement above your global_logger line in your rails 3 app and you 
> will see that this is correct.  Of course it is entirely possible that 
> the effects of calling global_logger may have changed, that depends on 
> what is in that method. 
>
>
The development mode code reloader is much smarter as of rails 3.2 - it no 
longer reloads everything on  every request. It will only reload a file if 
it thinks it needs to (although it almost certainly errs on the side of 
caution). If you want something to run on every request, use a 
before/after/around filter

Fred

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/27be1b32-b370-4b7f-961f-33a310dbd505%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to