#23 √ resolved
Shane Mingins

Still Trouble With Exception Notification Plugin

Reported by Shane Mingins | June 24th, 2008 @ 05:49 PM

ActionView::MissingTemplate (Missing template exception_notifier/exception_notification.html.erb in view path

Here is the output of debugging initialize_template_class_with_engine_additions:

/Users/smingins/Work/connect/projects/nascar_infield/vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb:74

renderer.finder.view_paths = ActionController::Base.view_paths.dup

(rdb:1) list

[69, 78] in /Users/smingins/Work/connect/projects/nascar_infield/vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb

69 # modules if the method implemention from the regular class is not called

70 #

71 # ActionView::Base.new(ActionController::Base.view_paths.dup, assigns, self)

72 renderer = initialize_template_class_without_engine_additions(assigns)

73 debugger

=> 74 renderer.finder.view_paths = ActionController::Base.view_paths.dup

75 renderer

76 end

77 end

78

(rdb:1) pp renderer.finder.view_paths

["/Users/smingins/Work/connect/projects/nascar_infield/vendor/plugins/exception_notification/lib/../views"]

(rdb:1) pp ActionController::Base.view_paths.dup

["/Users/smingins/Work/connect/projects/nascar_infield/app/views",

"/Users/smingins/Work/connect/projects/nascar_infield/vendor/plugins/connect_engine/app/views"]

(rdb:1)

Setting renderer.finder.view_paths overrides the current view_paths.

This was an issue way back with Rails 2.0 and the only other alternative was to change the exception notification plugin structure.

I patched our copy of engines back then to append to the renderer view path which seemed to then work fine (and has done ever since) .... so now upgrading to Rails 2.1 and Engines ... we're back with this problem .... and there was no comment on why appending instead of setting (and overriding) was not an option on the old trac ticket.

Comments and changes to this ticket

  • Shane Mingins

    Shane Mingins June 24th, 2008 @ 06:02 PM

    So I am looking at replacing:

    renderer.finder.view_paths = ActionController::Base.view_paths.dup

    with:

    renderer.finder.append_view_path(ActionController::Base.view_paths.dup)

  • Shane Mingins

    Shane Mingins June 26th, 2008 @ 04:55 PM

    • → Tag changed from “” to “exception_notification”

    Just to add info:

    Create New rails 2.1 app

    Install and configure exception_notification

    Install and configure rails engines

    Create exception in controller method

    ActionView::MissingTemplate (Missing template exception_notifier/exception_notification.html.erb in view path /Users/smingins/Work/exception_notification/app/views)

  • Yong Bakos

    Yong Bakos June 27th, 2008 @ 09:58 AM

    • → Assigned user changed from “” to “James Adam”

    I too am confirming this bug.

  • James Adam

    James Adam June 30th, 2008 @ 11:07 AM

    • → Tag changed from “exception_notification” to “action_mailer exception_notification”
    • → State changed from “new” to “more_details_needed”

    I'm having trouble replicating this. Here's what I tried:

    lazyatom:tmp james$ rails --version
    Rails 2.1.0
    lazyatom:tmp james$ rails test_exception_notifier
    ... rails installs ...
    lazyatom:tmp james$ cd test_exception_notifier/
    lazyatom:test_exception_notifier james$ script/plugin install git://github.com/lazyatom/engines.git
    ... engines plugin installs ...
    
    (Now add "require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')" under the rails boot line in environment.rb)
    
    lazyatom:test_exception_notifier james$ script/plugin install http://dev.rubyonrails.org/svn/r...
    ... exception_notification plugin installs ...
    
    (Now add "ExceptionNotifier.exception_recipients = %w(joe@schmoe.com bill@schmoe.com)" to the end of environment.rb)
    
    lazyatom:test_exception_notifier james$ cat > app/controllers/simple_controller.rb
    class SimpleController < ApplicationController
      include ExceptionNotifiable
      def index
        raise "Fail!"
      end
    end
    (ctrl-d)
    
    lazyatom:test_exception_notifier james$ script/server -d
    lazyatom:test_exception_notifier james$ curl http://localhost:3000/simple
    

    The output was simply the exception, as I would expect. Can you give more details?

  • Shane Mingins

    Shane Mingins June 30th, 2008 @ 12:55 PM

    Hi James

    Hey a couple of questions about your setup above ...

    1. Did you set config.action_controller.consider_all_requests_local to false? Or you could just run in production mode. You need to so that it will attempt to render the 500 and send the email etc.

    2. Did you configure exception notification?

    Add to appplication controller

    include ExceptionNotifiable

    local_addresses.clear

    These could be the missing details I hope.

  • James Adam

    James Adam June 30th, 2008 @ 09:35 PM

    Ah, it was the consider_all_requests_local that I'd forgotten.

    I've pushed a potential fix to a new branch on github called

    "fix_compatibility_with_exception_notification" - can you try using

    that to see if it fixes your issue?

    Thanks!

    James

  • Shane Mingins

    Shane Mingins June 30th, 2008 @ 10:41 PM

    Hi James

    Yes that fixes the problem.

    Cheers

    Shane

  • azimux

    azimux July 14th, 2008 @ 11:12 AM

    I also encountered this problem and the fix_compatibility_with_exception_notification branch also fixed the problem for me.

  • James Adam

    James Adam July 14th, 2008 @ 12:22 PM

    • → State changed from “more_details_needed” to “resolved”

    This is fixed in 38037f87f9f2d1ff5fb47ff4d28f4176a63b9a72 - thanks for your help guys!

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

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

The rails engines plugin itself

Shared Ticket Bins

People watching this ticket