Production mode class caching

If I wanted to do something funky along the lines of dynamically
changing a call to an extenal routing module from within routes.rb
based on the incoming request domain… would routes.rb be cached when
in production mode or will it be evaluated afresh for every request?

David S. wrote:

If I wanted to do something funky along the lines of dynamically
changing a call to an extenal routing module from within routes.rb
based on the incoming request domain… would routes.rb be cached when
in production mode or will it be evaluated afresh for every request?

im pretty sure its cached, otherwise you wouldnt need to restart the
webs erver when making changed to routes.rb

peace

–jake

David S. wrote:

If I wanted to do something funky along the lines of dynamically
changing a call to an extenal routing module from within routes.rb
based on the incoming request domain… would routes.rb be cached when
in production mode or will it be evaluated afresh for every request?

The file itself is cached, but you can still have methods and other
stuff in there that get properly executed. The code is cached, but not
the codes result for each route.

So as long your code doesnt actually alter the contents of routes.rb,
then you should be fine.

And if you are rewriting routes.rb I strongly finding a better way to
handle this.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs