Probably not the problem with scattering the file all over the place.
More likely to do with Rails' dynamic reloading of the files on each
refresh in development mode.
What happens if you turn on class caching or run in production mode?
If this works, you might want to move the require 'foo' into the
application_controller as a more central require location or even
better, put it in as an initializer file in config/initializers if you
are on Rails 2.0 or in an environment.rb file if you are not.