If you're planning to use the combination of engines and threadsafe! you'll need to do some extra work. Due to a bug in Rails the engine load paths are not added to the eager_load_paths at startup time. This makes engines unavailable in threadsafe! mode.
Fortunately, working around this problem is simple. Just subclass the plugin loader like this:
1 2 3 4 5 6 7 8
|
class EagerLoader < Rails::Plugin::Loader def add_plugin_load_paths super engines.each do |engine| configuration.eager_load_paths += engine.load_paths end end end |
And wire up your new loader in your environment.rb:
1 2 3 4 5 6 7 8 9
|
#require the plugin loader require File.join(File.dirname(__FILE__), '..', 'lib', 'eager_loader')
Rails::Initializer.run do |config| #override the default loader config.plugin_loader = EagerLoader
# ... end |
2 comments:
Totally saved my day! Thanks.
close. Almost got threadsafe working :)
No plugin called 'substruct' - please use the full name of a loaded plugin.
Extracted source (around line #15):
12: <%= javascript_include_tag :defaults, :cache => 'default' %>
13: <%=
14: javascript_include_tag(
15: 'substruct', 'subModal', 'lightbox',
16: :plugin => 'substruct',
17: :cache => 'substruct_cache'
18: )
Post a Comment