reto
reto

Reputation: 16732

Rails: Mark a class as NOT reloadable

I've got a few classes in lib/ which are not reloadable (due to their internal structure, its a jruby application). How can I tell rails to not reload these after each and every request?

Thanks!

Upvotes: 1

Views: 455

Answers (1)

BaroqueBobcat
BaroqueBobcat

Reputation: 10150

After looking at this post about adding reloadability to plugins, I think what you could try doing is adding the file your class resides in to ActiveSupport::Dependencies.load_once_paths

Add something like this in config/environments/development.rb:

ActiveSupport::Dependencies << (Rails.root + "lib/your_class.rb").to_s

The trade off is that you will need to restart your script/server process every time you change one of the files.

Upvotes: 2

Related Questions