If you want the dependency to be reloaded in dev mode, you need to
use ''require_dependency'' instead of
''require''. This lets Rails know
that the file ought to be reloaded with everything else.
- Jamis
On Aug 2, 2005, at 9:13 AM, Belorion wrote:
> So, if I understand correctly, development mode reloads any/all files
> it uses on every request (which is why in dev mode your changes appear
> on the next reload without restarting the webserver).
>
> Now, I have some files that sit outside the standard app/ hierarchy.
> Specifically, I have a plugin''s directory (sister directory to
app/),
> that contains a myconfig.rb file that is loaded by environment.rb.
> This configuration file in turn does a require on other files that I
> need from my plugins directory.
>
> In my particular case, I am adding a method to my User class. So, the
> original User class definition is in app/models/user.rb. In
> plugins/models/user.rb, I do this:
>
> class User < ActiveRecord::Base
> def foo
> #return something
> end
> end
>
> When the app is first loaded calling userobject.foo() works just fine.
> However, when I reload the page, I get a no method error -- I presume
> because Rails reloaded the original user.rb, but not my user.rb, thus
> forgetting about foo().
>
> So, my question then is how do I make sure plugins/myconfig.rb is
> loaded everytime in development mode? Everything works just fine in
> production mode, but that''s because everything is only ever loaded
> once. For obvious reasons, I want it working in dev mode as well.
> Any suggestions?
>
> Matt
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>