#1 ✓resolved
Nicholas Rutherford

response_for swallows template errors

Reported by Nicholas Rutherford | February 11th, 2009 @ 04:58 PM

Any error occurring in render silently fails to render resulting in the default action being rendered.

Comments and changes to this ticket

  • Ian White

    Ian White February 19th, 2009 @ 09:01 AM

    • State changed from “new” to “open”

    Criuti Balan wrote

    The error was "Template answers/create.erb not found".

    The response_for block was something like this:

    
     response_for :create do |format|
       format.html { render "questions/index" }
     end
    

    It turns out that there was an error in the view questions/index and
    response_for was caching that in like 140 of response_for.rb: http://github.com/ianwhite/respo...

    Rescuing the error like below (instead of using the single line
    rescue) seemed to fix it for me:

    
           begin
           respond_to do |responder|
             action_responses.each {|response| instance_exec(responder,  
    &response) }
           end
           rescue Responder::NoResponsesError
           end
    

    I'm not turning this into a patch because I have no clue what's going
    on there. This ruby syntax subtlety is escaping me :).

    Also, at line 159, shouldn't that be raise NoResponsesError instead of
    raise NoResponseError?: http://github.com/ianwhite/respo...

  • Ian White

    Ian White February 19th, 2009 @ 09:30 PM

    (from [7c899c00eccc6ee810dc615490863a6f0a37b521]) Added spec for when an error occurs in a template (currently failing) [#1] http://github.com/ianwhite/respo...

  • Ian White

    Ian White February 19th, 2009 @ 09:30 PM

    • State changed from “open” to “resolved”

    (from [89356bd5730e00a070addfe0789f33a49aff3b78]) Remove monkey patch of Reponder, as it's no longer necessary [#1 state:resolved] http://github.com/ianwhite/respo...

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

<a href="http://github.com/ianwhite/response_for">Get it from <strong>github</strong></a>

People watching this ticket

Referenced by

Pages