Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

render :file doesn't work for absolute path on windows

#2276

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.

Reported by Bivi · March 17th, 2009 @ 06:01 PM

State: resolved
Milestone: 2.x
Assigned to: josh josh
Importance: none

Activity

  1. thedarkone
    thedarkone
    • Assigned user set to josh

    I actually think we can drop all this special case view path faking.

    March 18th, 2009 @ 04:38 AM

  2. Bivi
    Bivi

    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.

    March 20th, 2009 @ 03:40 PM

  3. thedarkone
    thedarkone

    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.

    March 20th, 2009 @ 10:33 PM

  4. Repository
    Repository
    • State changed from new to resolved

    (from [d2e6a0fbc30d3fd03e7945306d18ed8ced8b20cf]) Simplify handling of absolute path templates. [#2276 render :file doesn't work for absolute path on windows state:resolved]

    Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...

    March 24th, 2009 @ 03:54 PM

  5. Repository
    Repository

    (from [e3b166aab37ddc2fbab030b146eb61713b91bf55]) Simplify handling of absolute path templates. [#2276 render :file doesn't work for absolute path on windows state:resolved]

    Signed-off-by: Joshua Peek josh@joshpeek.com http://github.com/rails/rails/co...

    March 24th, 2009 @ 03:54 PM