I have a problem running radiant mailer extension SystemStackError in SiteController#show_page
on any page, which doesn't contain mailer functionality.
I've found, that that there is a module that casus issues:
Module MailerProcess
include RecaptchaMailer
def self.included(base)
base.class_eval {
alias_method_chain :process, :mailer
attr_accessor :last_mail
}
end
def process_with_mailer(request, response)
# If configured to do so, receive and process the mailer POST
if Radiant::Config['mailer.post_to_page?'] && ...
# here process_mail from RecaptchaMailer called - works fine
end
process_without_mailer(request, response)
end
end
And here process_without_mailer
is what completely confuses me - there is no such definition. THis method actually causes lots of "SHOW TABLES" in logs and finally the exception.
This method i suspect is some more or less Rails part, bcause there are the same calls e.g. in actionpack-2.3.18/lib/action_controller/filters.rb
(process_without_filters
), rails-4.0.0/guides/source/active_support_core_extensions.md
(process_without_stringified_params
) - those methods also don't have any definitions.
So, there are two questions:
- why
process_with_mailer
is called during any page load? - what's the magic behind
process_without_mailer
?
UPD:
ok, commenting out method process_with_mailer
gives error during startup:
/home/sab/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-2.3.18/lib/active_support/core_ext/module/aliasing.rb:34:in `alias_method': undefined method `process_with_mailer' for class `Page' (NameError)
from /home/sab/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-2.3.18/lib/active_support/core_ext/module/aliasing.rb:34:in `alias_method_chain'
from /home/sab/_work/radiant-cms/vendor/extensions/mailer/lib/mailer_process.rb:6:in `block in included'
from /home/sab/_work/radiant-cms/vendor/extensions/mailer/lib/mailer_process.rb:5:in `class_eval'
So, probably alias_method_chain
causes calling method every page load, but mechanics is unclear to me. I've found some ActiveSuppor doc.
UPD2 well i ended up with
- Reading Ruby on Rails: alias_method_chain, what exactly does it do?
- commenting out
process_with_mailer
andalias_method_chain
. on that configuration it sends emails, so that's acceptable. i still would like to know, what was author's general idea.