response_for rescue eats too much errors

2 views
Skip to first unread message

Cristi Balan

unread,
Feb 18, 2009, 8:17:20 PM2/18/09
to resources_...@googlegroups.com
Hi,

I had one response_for that didn't seem to work on rails edge.

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/response_for/blob/bcc544a726990f851051f09bb8799e69d0e34f46/lib/ardes/response_for.rb#L140

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/response_for/blob/bcc544a726990f851051f09bb8799e69d0e34f46/lib/ardes/response_for.rb#L159

Thanks,
Cristi

--
Cristi Balan
http://rubber.ducki.es
http://evil.che.lu

Ian White

unread,
Feb 19, 2009, 4:03:04 AM2/19/09
to resources_...@googlegroups.com
Hi Cristi, thanks very much for the bug report. I'll get on this today.

You can check the progress here: http://ianwhite.lighthouseapp.com/projects/10607-response_for/tickets/1-response_for-swallows-template-errors#ticket-1-2

Cheers,
Ian

Ian White

unread,
Feb 19, 2009, 4:35:03 PM2/19/09
to resources_controller
I believe this has been fixed in the master branch. Let me know if it
isn;t. Thanks again for the bug report.

Cheers,
Ian

Cristi Balan

unread,
Feb 21, 2009, 11:05:04 AM2/21/09
to resources_...@googlegroups.com
Hi Ian,

Thanks for getting on this so quickly :).

I can confirm that your recent commits fixed the issue.

Cheers,
Cristi
Reply all
Reply to author
Forward
0 new messages