This project is archived and is in readonly mode.
render :file doesn't work for absolute path on windows
Reported by Bivi | March 17th, 2009 @ 06:01 PM | in 2.x
On rails 2.3.2 if you try (on windows system):
render :file => "C:/myapp/app/views/main/home.html.erb"
you'll have a problem due to "C:/" which is not recognized as an absolute pathname.
I suspect a problem at the line 64 in "actionpack-2.3.2\lib\action_view\paths.rb" and propose the new regexp : /\A(\/|[a-zA-Z]:\/)/
But there is another problem at the line 112 in "actionpack-2.3.2\lib\action_view\template.rb" because
File.join("", "C:/myapp/app/views/main/home.html.erb") -> "/C:/myapp/app/views/main/home.html.erb"
So, for the moment, I'll use only relative paths.
Comments and changes to this ticket
-
thedarkone March 18th, 2009 @ 04:38 AM
- Assigned user set to josh
I actually think we can drop all this special case view path faking.
-
Bivi March 20th, 2009 @ 03:40 PM
Thanks for the patch, but ...
when I've tried it, I lost the backtrace page when any error occured in my application (a bad action name for example).
It seems that the problem lies around the "memoize :filename" line because in the log file there is an error like
ERROR: compiling _run_erb_C5847ruby... RAISED can't modify frozen object ... Backtrace: C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/memoizable.rb:71:in `filename' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.2/lib/action_view/renderable.rb:77:in `compile!' ...
So I commented the memoize :filename and now it seems to work fine.
-
thedarkone March 20th, 2009 @ 10:33 PM
Thanks for the feedback, the error you get doesn't make sense though...
Also the patch I posted was not against v2.3.2.1 and so it wasn't applying cleanly.
-
Repository March 24th, 2009 @ 03:54 PM
- State changed from new to resolved
(from [d2e6a0fbc30d3fd03e7945306d18ed8ced8b20cf]) Simplify handling of absolute path templates. [#2276 state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
-
Repository March 24th, 2009 @ 03:54 PM
(from [e3b166aab37ddc2fbab030b146eb61713b91bf55]) Simplify handling of absolute path templates. [#2276 state:resolved]
Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
Attachments
Referenced by
- 2276 render :file doesn't work for absolute path on windows (from [d2e6a0fbc30d3fd03e7945306d18ed8ced8b20cf]) Simplif...
- 2276 render :file doesn't work for absolute path on windows (from [e3b166aab37ddc2fbab030b146eb61713b91bf55]) Simplif...