Rails 1.2.6
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
=Summary:
I pass a non-nil parameter to an ActionMailer class’s deliver_* method.
The corresponding * instance method for the ActionMailer gets a nil
instead. Disaster ensues.
Will someone please tell me what I’m doing wrong?
=Details:
I have an ActionMailer::Base class with the following template method:
def request(req)
# Control reaches here. req is logged as nil:
logger.info “in MyMailer#request, request = #{req.inspect}”
# Exception in the following, owing to the nil:
subject "Request for authsmtp exception (#{req.permit_ip})"
# etc.
end
This is invoked through this method in my ActionController::Base class:
def create
@permission = Permission.new(params[:permission])
if @permission.save
# @permission is non-nil, and as expected, in the following log:
logger.info “In PermissionsController#create, @permission =
#{@permission.inspect}”
MyMailer.deliver_request(@permisssion) # Mail the request to
approvers.
# etc.
end
end
As noted in the comments, @permission is non-nil when passed to
deliver_request(). In request(), the corresponding parameter, req, is
nil. I am stymied.
I have searched the archives, and nothing obvious presents itself. Will
someone please help me get started again?
(This is my first post through this forum software. I am hoping it
doesn’t destroy linebreaks or indentation. If they do get clobbered, I
apologize, and would like to know how not to get them clobbered.)
— F