# ActionMailer undefined method \`parameters' - Rails 2.1

**URL:** <https://www.ruby-forum.com/t/actionmailer-undefined-method-parameters-rails-2-1/140095>\
**Category:** Rails\
**Created:** [June 10, 2008, 8:26pm UTC](https://www.ruby-forum.com/t/actionmailer-undefined-method-parameters-rails-2-1/140095 "2008-06-10T20:26:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [June 10, 2008, 8:26pm UTC](https://www.ruby-forum.com/t/actionmailer-undefined-method-parameters-rails-2-1/140095/1 "2008-06-10T20:26:54Z")

</div>

Hello Rubyists,  
I’m currently trying to get email hooked up via ActionMailer, and while  
I’ve gotten it to work in the past on Rails 1.2.x, I’m seeing an error  
that I’m unfamiliar with.

Right now, I’m just trying to send email from my dev box via the SMTP  
server at work.

My development.rb file:  
#…snip  
config.action\_mailer.delivery\_method = :smtp  
config.action\_mailer.smtp\_settings = {  
:address =\> ‘[ourmailserver.whereiwork.com](http://ourmailserver.whereiwork.com)’,  
:port =\> 25  
}  
config.action\_mailer.perform\_deliveries = true  
config.action\_mailer.raise\_delivery\_errors = true  
#…snip

My “Notifications” Model:

class Notifications \< ActionMailer::Base

def request(sent\_at = Time.now)  
subject ‘Testing’  
recipients [‘removed\_email\_address@domain.invalid’]  
from ‘removed\_email\_address@domain.invalid’  
body :greeting =\> “WAUW”  
end

end

The part of my controller that actually sends the mail:  
#…snip  
def create  
@request = Request.new(params[:request])  
respond\_to do |format|  
if @request.save  
Notifications.deliver\_request  
flash[:notice] = ‘Request was successfully created.’  
format.html { redirect\_to(@request) }  
format.xml { render :xml =\> @request, :status =\> :created,  
:location =\> @request }  
else  
#…snip

As you can see, this was all just stubbed out using a scaffold  
generator.

Now - when I go to create a “Request”, the record is created and that’s  
all good, but I’m greeted with this monstrosity:

NoMethodError in RequestsController#create  
undefined method `parameters’ for {:greeting=\>“WAUW”}:Hash

/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_view/base.rb:301:in  
`template_format' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_finder.rb:138:in `pick\_template\_extension’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_view/template.rb:68:in  
`set_extension_and_file_name' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_view/template.rb:15:in `initialize’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_view/base.rb:245:in  
`new' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:245:in `render\_file’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_view/base.rb:269:in  
`render' /Library/Ruby/Gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:541:in `render’  
/Library/Ruby/Gems/1.8/gems/actionmailer-2.1.0/lib/action\_mailer/base.rb:533:in  
`render_message' /Library/Ruby/Gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:478:in `create!’  
/Library/Ruby/Gems/1.8/gems/actionmailer-2.1.0/lib/action\_mailer/base.rb:439:in  
`initialize' /Library/Ruby/Gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/base.rb:383:in `new’  
/Library/Ruby/Gems/1.8/gems/actionmailer-2.1.0/lib/action\_mailer/base.rb:383:in  
`method_missing' app/controllers/requests_controller.rb:44:in `create’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/base.rb:1162:in  
`send' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1162:in `perform\_action\_without\_filters’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/filters.rb:580:in  
`call_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in `perform\_action\_without\_benchmark’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/benchmarking.rb:68:in  
`perform_action_without_rescue' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform\_action\_without\_rescue’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/rescue.rb:201:in  
`perform_action_without_caching' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:13:in `perform\_action’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active\_record/connection\_adapters/abstract/query\_cache.rb:33:in  
`cache' /Library/Ruby/Gems/1.8/gems/activerecord-2.1.0/lib/active_record/query_cache.rb:8:in `cache’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/caching/sql\_cache.rb:12:in  
`perform_action' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in `send’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/base.rb:529:in  
`process_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:in `process\_without\_session\_management\_support’  
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action\_controller/session\_management.rb:130:in  
`process' /Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:in `process’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel/rails.rb:76:in  
`process' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel/rails.rb:74:in `synchronize’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel/rails.rb:74:in  
`process' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:159:in `process\_client’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in `each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:158:in `process\_client’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `initialize’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:285:in `run’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in  
`initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `new’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:268:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:282:in `run’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:in  
`each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel/configurator.rb:281:in `run’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/bin/mongrel\_rails:128:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/lib/mongrel/command.rb:212:in `run’  
/Library/Ruby/Gems/1.8/gems/mongrel-1.1.4/bin/mongrel\_rails:281  
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active\_support/dependencies.rb:502:in  
`load' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load’  
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active\_support/dependencies.rb:354:in  
`new_constants_in' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load’  
/Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/commands/servers/mongrel.rb:64  
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active\_support/dependencies.rb:509:in  
`require' /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new\_constants\_in’  
/Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active\_support/dependencies.rb:509:in  
`require’  
/Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39

Any help with this is much appreciated! : )

---

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [June 10, 2008, 8:34pm UTC](https://www.ruby-forum.com/t/actionmailer-undefined-method-parameters-rails-2-1/140095/2 "2008-06-10T20:34:46Z")

</div>

I’m not an ActionMailer expert, but shouldn’t

> def request(sent\_at = Time.now)  
> subject ‘Testing’  
> recipients [‘removed\_email\_address@domain.invalid’]  
> from ‘removed\_email\_address@domain.invalid’  
> body :greeting =\> “WAUW”  
> end

look like

def request(sent\_at = Time.now)  
@subject = ‘Testing’  
@recipients = [‘removed\_email\_address@domain.invalid’]  
@from = ‘removed\_email\_address@domain.invalid’  
@body[:greeting] = “WAUW”  
end

Peace,  
Phillip

---

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [June 10, 2008, 8:37pm UTC](https://www.ruby-forum.com/t/actionmailer-undefined-method-parameters-rails-2-1/140095/3 "2008-06-10T20:37:44Z")

</div>

Hi Phillip,  
Thank you for the fast reply. In the past, that’s what it used to look  
like, yes. Past == other older applications (Rails 1.2.x was the last I  
used to do mail).

But I generated this using the script/generate mailer in Rails 2.1, so I  
would assume that ActionMailer’s been refactored to use methods for  
assigning subject, etc. rather than instance variables?

Thanks,  
kodama

Phillip K. wrote:

> I’m not an ActionMailer expert, but shouldn’t
> 
> > def request(sent\_at = Time.now)  
> > subject ‘Testing’  
> > recipients [‘removed\_email\_address@domain.invalid’]  
> > from ‘removed\_email\_address@domain.invalid’  
> > body :greeting =\> “WAUW”  
> > end
> 
> look like
> 
> def request(sent\_at = Time.now)  
> @subject = ‘Testing’  
> @recipients = [‘removed\_email\_address@domain.invalid’]  
> @from = ‘removed\_email\_address@domain.invalid’  
> @body[:greeting] = “WAUW”  
> end
> 
> Peace,  
> Phillip

---

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [June 10, 2008, 8:46pm UTC](https://www.ruby-forum.com/t/actionmailer-undefined-method-parameters-rails-2-1/140095/4 "2008-06-10T20:46:13Z")

</div>

Old E. wrote:

> Hi Phillip,  
> Thank you for the fast reply. In the past, that’s what it used to look  
> like, yes. Past == other older applications (Rails 1.2.x was the last I  
> used to do mail).
> 
> But I generated this using the script/generate mailer in Rails 2.1, so I  
> would assume that ActionMailer’s been refactored to use methods for  
> assigning subject, etc. rather than instance variables?
> 
> Thanks,  
> kodama

I haven’t done anything with 2.1 yet as a plugin I use (Malline) is not  
2.1 ready. I’ve used the notation I posted with 1.2.x and 2.0.2  
successfully. Surprised it got changed. I’ll have to do some digging to  
see what other surprises 2.1 holds.

Sorry to have wasted your time.  
Phillip

---

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [June 10, 2008, 8:58pm UTC](https://www.ruby-forum.com/t/actionmailer-undefined-method-parameters-rails-2-1/140095/5 "2008-06-10T20:58:12Z")

</div>

No worries - I’m glad to have gotten an answer. Who knows - I’ll try and  
change it to see if maybe it’s “legacy compatible”. 😃

Phillip K. wrote:

> I haven’t done anything with 2.1 yet as a plugin I use (Malline) is not  
> 2.1 ready. I’ve used the notation I posted with 1.2.x and 2.0.2  
> successfully. Surprised it got changed. I’ll have to do some digging to  
> see what other surprises 2.1 holds.
> 
> Sorry to have wasted your time.  
> Phillip

---

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [June 10, 2008, 11:22pm UTC](https://www.ruby-forum.com/t/actionmailer-undefined-method-parameters-rails-2-1/140095/6 "2008-06-10T23:22:37Z")

</div>

Can you post line 44 of your requests\_controller (or the code around  
line 44)

app/controllers/requests\_controller.rb:44:in `create’

On Jun 10, 11:58 am, Old E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [June 10, 2008, 11:27pm UTC](https://www.ruby-forum.com/t/actionmailer-undefined-method-parameters-rails-2-1/140095/7 "2008-06-10T23:27:56Z")

</div>

A screencast I stumbled upon recently just completed an ActionMailer  
episode.

[http://www.buildingwebapps.com/podcasts/19-adding-a-contact-form-and-mailer/show\_notes](http://www.buildingwebapps.com/podcasts/19-adding-a-contact-form-and-mailer/show_notes)  
[http://s3.amazonaws.com/lr\_screencasts/learningrails-18.mov](http://s3.amazonaws.com/lr_screencasts/learningrails-18.mov)

Hope this helps a bit.

Regards  
Kieran

On Wed, Jun 11, 2008 at 6:58 AM, Old E.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![kodama](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/439d5e/32.png) [@kodama](https://www.ruby-forum.com/u/kodama)\
**Post date:** [June 10, 2008, 11:31pm UTC](https://www.ruby-forum.com/t/actionmailer-undefined-method-parameters-rails-2-1/140095/8 "2008-06-10T23:31:29Z")

</div>

try  
def create(params)
