This project is archived and is in readonly mode.
Modified views outside of config.view_path are not recompiled in development mode
-
DHH
- Milestone cleared.
- Assigned user set to josh
-
Andrew White
Found the cause - the additional view paths are added as ActionView::Template::EagerPath whereas the initial 'app/views' is added as a simple ActionView::Template::Path.
The quick and dirty fix is for ActionView::PathSet.type_cast to type cast to Path when cache_classes is false rather than EagerPath. However it may be more beneficial to try and refactor the code to get template reloading working in production mode as well.
-
Andrew White
- Tag changed from actionpack, actionview, views to actionpack, actionview, patch, views
Patch for the quick and dirty fix. No tests - not quite sure how to test modification of a template file being reloaded.
-
josh
- State changed from new to wontfix
Applying the patch breaks many unit tests.
Maybe EagerPath should still be the default? Would that still solve the problem?
-
Andrew White
Defaulting to EagerPath breaks reloading everywhere including app/views so I don't think that's going to be acceptable!
Looking at the test failures (after defining Rails) they all seem to be of the type:
<ActionView::Template::EagerPath> expected but was <ActionView::Template::Path>.
which is obviously easy to fix, however I'm wondering whether it might be better to try and fix it at a more fundamental level and bring back support for reloading templates in production mode as well. The question is would such a large patch be accepted at this stage of the 2.3 release?
-
josh
I meant flipping the conditional, so if no Rails const is available default to eager so the AP tests pass.
-
Andrew White
Sorry, yes that works - attached patch passes all tests and reloads templates outside of app/views.
-
josh
- State changed from wontfix to open
-
Repository
- State changed from open to resolved
(from [bccd2c54b2c7708f881faf9c9464dcf29bd30bef]) Use Path rather than EagerPath when cache_classes == false so other view paths are properly recompiled in development mode [#1764 Modified views outside of config.view_path are not recompiled in development ... state:resolved] Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
