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', :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 ['me@whereiwork.com'] from 'testmailerbot@whereiwork.com' 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! : )