# ActionMailer template gets nil param from non-nil deliver\_

**URL:** <https://www.ruby-forum.com/t/actionmailer-template-gets-nil-param-from-non-nil-deliver/151192>\
**Category:** Rails\
**Created:** [October 17, 2008, 10:40pm UTC](https://www.ruby-forum.com/t/actionmailer-template-gets-nil-param-from-non-nil-deliver/151192 "2008-10-17T22:40:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fritza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5f9b8f/32.png) [@fritza](https://www.ruby-forum.com/u/fritza)\
**Post date:** [October 17, 2008, 10:40pm UTC](https://www.ruby-forum.com/t/actionmailer-template-gets-nil-param-from-non-nil-deliver/151192/1 "2008-10-17T22:40:19Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![fritza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/5f9b8f/32.png) [@fritza](https://www.ruby-forum.com/u/fritza)\
**Post date:** [October 20, 2008, 4:59pm UTC](https://www.ruby-forum.com/t/actionmailer-template-gets-nil-param-from-non-nil-deliver/151192/2 "2008-10-20T16:59:14Z")

</div>

Fritz A. wrote:

> 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.

Never mind. The cause was a typo in my own code, and my (apparently  
failing) eyes never managed to see it.

Thanks for the attention of whomever paid attention.

```
â€” F
```
