This project is archived and is in readonly mode.
"Template is missing" error for engine in production environment
-
Ngoc Dao
The correct view path should be: vendor/plugins/my_app/app/views
-
Stephan Kaag
Same problem here. In development environment the engine works fine. In production it fails with the same error described above
-
Stephan Kaag
Calling @@ActionController::Base.view_paths@@ in Rails::Plugin::Loader's add_engine_view_paths seems to fix this as a workaround.
A real solution is needed because this functionality is really broken at the moment.
-
Stephan Kaag
Problem found.
The cause is this commit: http://github.com/rails/rails/co...
In production environment the view-path is 'resetted' in the function 'load_view_paths'. The engines view-paths are left out.
-
Stephan Kaag
- Tag changed from actionview, edge, production, view to 2.3, actionview, production, view
This problem also occurs in the RC for 2.3
-
marcbey
I get this error also on development environment.
-
DHH
- Assigned user set to Yehuda Katz (wycats)
- Milestone cleared.
-
David Reese
Here's a simple fix, just changes the existing ActionController::Base.view_paths to EagerPaths.
ActionController::Base.view_paths is already set earlier (in initialize_framework_views, then added to in load_plugins if there are any engine plugins), so configuration.view_path is already in the view_paths -- no need to reference it again.
-
Glenn Powell
Or another simple fix where you don't have to mess with the core code, is to just append the engine paths by hand into ApplicationController.view_paths at the end of your application_controller.rb file. This is just a hack until the core is fixed, of course, but it does the job.
-
David Reese
Thank you, Glenn, not messing with core code would have been a better idea!
My last patch is wrong. There was of course more refactoring to be done.
Paths are already added correctly as EagerPaths/Paths, depending on cache_classes config, through the setter method on AC::Base.view_paths... but only if they're added as strings, not as ActionView::Template::Path. So initialize_framework_views needed cleanup.
Now, i'm not sure why #load_view_paths needs to exist at all. If there are any view paths, they've already been added correctly (eagerly), afaict.
[there's of course another ticket somewhere RE: the view path confusion in ActionMailer (template_root vs view_paths).]
now wycats, you probably know all this already and this would have taken you 5 minutes...
-
Andrew White
I've just added ticket #1909 Improve view performance in development and reinstate template reloading in p... which should fix this problem along with some extra benefits. I'd be grateful if you could check it out and see if it fixes things for you.
-
Sven Fuchs
Trying to migrate a heavily engines-based app to 2.3 I've applied David's latest patch and it seems to work for me for ActionView view_paths. ActionMailer does not pick up templates from plugins though but instead breaks with a MethodMissing #find_template for class String (or something like that).
I've come up with the attached patch which certainly is not the right way to solve it (i guess), but maybe it's helpful to point out what's breaking.
(Ah, I should mention that the attached patch is based on David's latest one.)
-
David Reese
thanks sven... I realized ActionMailer wasn't getting the paths right but I went ahead and tried Andrew White's patch (on #1909 Improve view performance in development and reinstate template reloading in p...) and it both fixed the original problem (this ticket) and vastly sped up my dev environment.
From what I can tell, ActionMailer is still not actually using all the view paths you send it -- in the initialize it gets templates from template root, which is:
def template_root self.view_paths && self.view_paths.first end(Meanwhile I encountered an unsolvable bug in 2.3 where my cookies weren't being written correctly. Not even sure where to file that bug (rails? rack? passenger?) So i'm back to 2.2 and called it a day.)
-
Thijs
David, maybe this ticket has something to do with your cookies problem?
-
Andrew White
Josh, I'm pretty sure you can close this ticket as being fixed by the changes in #1909 Improve view performance in development and reinstate template reloading in p.... I can reproduce this error using 2.3.0 but I can't with edge.
-
josh
- Assigned user changed from Yehuda Katz (wycats) to josh
- State changed from new to resolved
