[Radiant] radiant + exception_notification plugin
Michael Hale
mikehale at gmail.com
Thu Jul 3 10:38:53 CDT 2008
Ok it turns out that adding the pastie was only half the fix. I also
needed to update the views_path which I did in an initializer. Here is
what my app/config/initializers/exception_notification.rb looks like:
# Make exception notifier compatible with radiant
require 'exception_notifier_ext'
ExceptionNotifier.send(:include, ExceptionNotifierExt)
ActionMailer::Base.view_paths <<
"#{RAILS_ROOT}/vendor/plugins/exception_notification/views"
class ApplicationController < ActionController::Base
include ExceptionNotifiable
end
ExceptionNotifier.sender_address = %("Application Error" <app.error at domain>)
ExceptionNotifier.exception_recipients = %w(mikehale at gmail.com)
On Mon, Jun 30, 2008 at 4:28 PM, Michael Hale <mike at hales.ws> wrote:
> Hi Thanks for the help. I tried installing the pastie as you
> suggested, but it doesn't fix the issue I am having.
>
> Upon further inspection it seems that all that the code does is
> include ExceptionNotifierHelper in ExceptionNotifier. I guess I don't
> understand how that will add exception_notification/views to the
> views_path.
>
> On Sat, Jun 28, 2008 at 11:11 AM, Casper Fabricius
> <me at casperfabricius.com> wrote:
>> Hi Michael,
>>
>> I've run into the same problem, and solved it by adding a small mixin that
>> overrides a method in ExceptionNotifier:
>>
>> http://pastie.org/223988
>>
>> Put this code in a file in lib and make sure to include it and mix it in in
>> environment.rb or in an extension class:
>>
>> ::ExceptionNotifier.send :include, ExceptionNotifierExt
>>
>> Cheers,
>> Casper
>>
>>
>>
>> On 27/06/2008, at 22:26, Michael Hale wrote:
>>
>>> Hi all,
>>>
>>> I'm having trouble using the exception_notification with radiant.
>>>
>>> The problem seems to be that the plugin's views dir is not in
>>> ActionMailer::Base.view_paths. I was able to hack around the problem
>>> and send an email by adding a line like this:
>>> view_paths << 'radiant_app/vendor/plugins/exception_notification/views'
>>> to radiant's Radiant::MailerViewPathsExtension#full_template_path
>>> (mailer_view_paths_extension.rb:18)
>>>
>>> My question is how do I properly tell ActionMailer::Base (which is
>>> what Radiant::MailerViewPathsExtension is extending) about the
>>> exception_notification's views dir? Or is there a better way to have
>>> exception_notifications in radiant?
>>>
>>> Thanks, Michael
>>>
>>> BTW here is the relevant portion of my stack trace for reference:
>>>
>>> Rendering radiant_app/public/500.html (500 Error)
>>> /!\ FAILSAFE /!\ Fri Jun 27 16:08:35 -0400 2008
>>> Status: 500 Internal Server Error
>>> can't convert nil into String
>>>
>>> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.6.7/lib/plugins/extension_patches/lib/mailer_view_paths_extension.rb:87:in
>>> `dirname'
>>>
>>> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.6.7/lib/plugins/extension_patches/lib/mailer_view_paths_extension.rb:87:in
>>> `initialize_template_class'
>>>
>>> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.6.7/vendor/rails/actionmailer/lib/action_mailer/base.rb:502:in
>>> `render'
>>>
>>> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.6.7/vendor/rails/actionmailer/lib/action_mailer/base.rb:494:in
>>> `render_message'
>>>
>>> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.6.7/lib/plugins/extension_patches/lib/mailer_view_paths_extension.rb:65:in
>>> `create!'
>>>
>>> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.6.7/vendor/rails/actionmailer/lib/action_mailer/base.rb:403:in
>>> `initialize'
>>>
>>> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.6.7/vendor/rails/actionmailer/lib/action_mailer/base.rb:352:in
>>> `new'
>>>
>>> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.6.7/vendor/rails/actionmailer/lib/action_mailer/base.rb:352:in
>>> `method_missing'
>>>
>>> radiant_app/vendor/plugins/exception_notification/lib/exception_notifiable.rb:95:in
>>> `rescue_action_in_public'
>>>
>>> /opt/local/lib/ruby/gems/1.8/gems/radiant-0.6.7/app/controllers/application.rb:36:in
>>> `rescue_action_in_public'
>>> _______________________________________________
>>> Radiant mailing list
>>> Post: Radiant at radiantcms.org
>>> Search: http://radiantcms.org/mailing-list/search/
>>> Site: http://lists.radiantcms.org/mailman/listinfo/radiant
>>
>> _______________________________________________
>> Radiant mailing list
>> Post: Radiant at radiantcms.org
>> Search: http://radiantcms.org/mailing-list/search/
>> Site: http://lists.radiantcms.org/mailman/listinfo/radiant
>>
>
More information about the Radiant
mailing list