Skip to content

Commit

Permalink
fixed mailer
Browse files Browse the repository at this point in the history
  • Loading branch information
mkristian committed Mar 18, 2011
1 parent 4b25b73 commit f6bbdda
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/ixtlan/errors/error_dumper.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ def keep_dumps=(ttl)
end end


def dump_dir def dump_dir
unless @dump_dir if @dump_dir.blank?
@dump_dir = File.join(Rails.root, "log", "errors") @dump_dir = File.join(Rails.root, "log", "errors")
FileUtils.mkdir_p(@dump_dir) FileUtils.mkdir_p(@dump_dir)
end end
@dump_dir @dump_dir
end end


def dump_dir=(dr) def dump_dir=(dir)
@dump_dir = dir @dump_dir = dir
FileUtils.mkdir_p(@dump_dir) if dir FileUtils.mkdir_p(@dump_dir) unless dir.blank?
@dump_dir @dump_dir
end end


Expand All @@ -34,7 +34,7 @@ def dump(controller, exception)
logger = Logger.new(log_file) logger = Logger.new(log_file)


dump_environment(logger, exception, controller) dump_environment(logger, exception, controller)
Mailer.deliver_error_notification(@email_from, @email_to, exception, log_file) unless (@email_to.blank? || @email_from.blank?) Mailer.error_notification(@email_from, @email_to, exception, log_file).deliver unless (@email_to.blank? || @email_from.blank?)
log_file log_file
end end


Expand Down
2 changes: 1 addition & 1 deletion lib/ixtlan/errors/mailer.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Mailer < ActionMailer::Base


def error_notification(email_from, emails_to, exception, error_file) def error_notification(email_from, emails_to, exception, error_file)
@subject = exception.message @subject = exception.message
@body = {:text => "#{error_file}"} @text = "#{error_file}"
@recipients = emails_to @recipients = emails_to
@from = email_from @from = email_from
@sent_on = Time.now @sent_on = Time.now
Expand Down
2 changes: 1 addition & 1 deletion lib/ixtlan/errors/railtie.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Railtie < Rails::Railtie


config.before_configuration do |app| config.before_configuration do |app|


path = File.join(File.dirname(__FILE__), "mailer") path = File.join(File.dirname(__FILE__), "..", "..")
unless ActionMailer::Base.view_paths.member? path unless ActionMailer::Base.view_paths.member? path
ActionMailer::Base.view_paths= [ActionMailer::Base.view_paths, path].flatten ActionMailer::Base.view_paths= [ActionMailer::Base.view_paths, path].flatten
end end
Expand Down

0 comments on commit f6bbdda

Please sign in to comment.