3

I'm working on a Rails engine that allows the implementer to put classes in app/snippets.

From within the engine, I want to instruct the host Rails app to auto reload classes in app/snippets upon each request so that the implementer doesn't have to restart the server when making changes.

I understand there's a config.to_prepare initialization event I can hook into, but I can't get access to the app.root like I an in an initializer block. In other words:

initializer 'something' do |app|
  # I need app.root to derive app/snippets
end

config.to_prepare do
  # Can't get app.root from here
end

How can I auto reload classes in app/snippets upon each request?

Mike
  • 2,103
  • 3
  • 18
  • 24

0 Answers0