This project is archived and is in readonly mode.
render_to_string :template before normal render causes assert_template failures
-
Jarl Friis
The same problem occurs when using
render_to_string :file => ... -
Jarl Friis
- Tag set to 2.3.9, actionpack, activeview, render_to_string
-
Neeraj Singh
I am not able to reproduce it. Look at the attached test case.
Even if this ticket is rendered as invalid the attached patch could be merged because it is strengthening the existing test case. I checked and did not find any test covering the scenario mentioned in the patch.
@Jal can you create a small app on github so that I could reproduce the error. Thanks.
-
Neeraj Singh
not open to open the attachment. not sure why. uploading again.
-
Jarl Friis
Neeraj, done as you requested:
https://github.com/jarl-dk/bug5891This is a simple project created with
rails bug5891 cd bug5891 ./script/generate scaffold notesNow commit ffa0afcc94f5e9d357ee8d5c5ef94d9a0dd09d7a introduces a reasonable test that assert that the show action uses correct template. This test passes until commit a1ba70ae15a5e114419b2662ecb743f6b4d9a74d) that introduces a render_to_string in the controller that renders some other template (into a string).
@Neeraj, could you please from that create a failing test in rails 2.3-stable. I think the reason that you test (in your patch) does not fail is because both
render_to_string :template => "test/hello_world"and
render :template => "test/hello_world"renders the same template, try to change
render_to_stringto render some other template -
Neeraj Singh
@Jal thank you.
Now I am able to reproduce it.
def render_to_string_template_with_template_render #render_to_string :template => "test/hello_world" render_to_string :template => "shared" render :template => "test/hello_world" endI will look into it.
-
Neeraj Singh
- State changed from new to open
- Tag changed from 2.3.9, actionpack, actionview, render_to_string to 2.3.9, actionpack, actionview, patched, render_to_string
Attached is a patch with test cases. Big thanks to Jal for all the help.
-
Neeraj Singh
- Milestone set to 2.x
-
Neeraj Singh
- Assigned user changed from josh to José Valim
Assigning it to Mr. Valim as Josh was last seen in action at LH was in June.
-
Jarl Friis
@Neeraj: As I mention in comment 2. The problem also occurs if I use
render_to_string :file =>Could you make a test that covers that situation as well.
-
Neeraj Singh
Verified that this is not an issue with Rails 3.
@Jarl I lost my setup for this ticket. Will add to patch once I hear from José Valim to see if I am heading in the right direction.
Thanks.
