This project is archived and is in readonly mode.
Templates are not reloaded in development when using custom view path
-
thedarkone
Andrew, thanks for investigating the issue and posting a detailed description in #1909 . I would have sworn that
prepending_view_pathsshould not have been causing any problems whatsoever.0001-Fix-an-edge-case-where-we-might-encounter-some-rando.patchgives up on manually tracking compiled methods and just grepsCompiledMethods.public_instance_methodsfor any suspects to undef. -
josh
- State changed from new to open
- Milestone cleared.
-
thedarkone
Once again I suck so more at making diffs :(.
-
josh
Do you guys have any wild ideas how we can test the development reloading better? It seems like these issues continue to regress.
-
thedarkone
Well there are a few issues with reloadable templates.
-
It is a tricky thing to implement correctly, the are a lot of little nuances that you need to cover (what happens if a I delete a template, what if I rename it, what if I just change an extension, what if I pass different locals, etc.)
-
ActionViewis not written to be reloadable-template friendly. I took a peek at Rails 3 code base and things will get better there. -
You can't really unit test it very well as it would require an exponential amount of tests (think about it as every unit test you already have in
ActionViewmultiplied by all the edge cases mentioned in the first point).
Not all is as gloom and hopeless though.
-
This is really the first regression since it got commited (I don't think anything serious is going to come out of #2005).
-
The code has been extracted out of a plugin, that has seen some testing. I did test just this case and there were no issues because that was in a context of
rails-dev-boost, where classes are not reloaded unless they've changed, so it behaved like a production environment. That's why I missed this. -
The whole
reloadable_template.rbis 120 LoC with something like 40 LoC of a real code. So it's not like we're talking about some dark impenetrable voodoo stuff like routes or constant loading.
-
-
Manfred Stienstra
It is a tricky thing to implement correctly […]
That's exactly why you want to write tests for this. The original authors are the only ones who know how it currently works, and they will forget. In a year or even a few months no-one will know how this is supposed to work, with tests anyone can stay contributing.
You can't really unit test it very well as it would require an exponential amount of tests (think about it as every unit test you already have in ActionView multiplied by all the edge cases mentioned in the first point).
Sure you can, shared test are easy, just define them on a module and include then in a number of TestCases with different setups.
The whole reloadable_template.rb is 120 LoC with something like 40 LoC of a real code. So it's not like we're talking about some dark impenetrable voodoo stuff like routes or constant loading.
Short pieces of code require less testing code, yet constant reloading and routing are tested, so that's actually an argument for testing.
-
thedarkone
Manfred, thank you for your suggestions, I know you are trying to be helpful.
0001-Fix-regressions-that-have-popped-up.patch- droppedexpand_path, this should fix #2005, also added a few more tests. -
Repository
- State changed from open to resolved
(from [f8ea9f85d4f1e3e6f3b5d895bef6b013aa4b0690]) Fix templates reloading in development when using custom view path [#2012 state:resolved] http://github.com/rails/rails/co...
-
josh
- State changed from resolved to open
Failing ActionMailer test: http://ci.rubyonrails.org/builds...
-
thedarkone
I hate mailer and railties test suites.
-
josh
As do I :)
But is that correct? It seems like that test is explicitly removing the "./", maybe for a good reason? I really have no idea.
-
thedarkone
No worries, this exact explicit removal was introduced by me in a an early patch :). It is related to how I was normalizing/expanding view paths (that didn't go all to well on windows, so it is no longer being done).
Besides if we are talking about directory structure
"test/fixtures/path.with.dots"and"./test/fixtures/path.with.dots"are AFAIK equivalent. -
josh
- State changed from open to resolved
