Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5936379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:23:27+00:00 2026-05-22T15:23:27+00:00

I am learning to how send email with Rails 3 with Agile Web Development

  • 0

I am learning to how send email with Rails 3 with Agile Web Development Book, Task H. However, I keep getting the following error:

ArgumentError in OrdersController#create

wrong number of arguments (1 for 0)
Rails.root: /Applications/XAMPP/xamppfiles/htdocs/rails_projects/TUTORIALS/depot

Application Trace | Framework Trace | Full Trace
app/mailers/notifier.rb:4:in `order_received'
app/controllers/orders_controller.rb:57:in `block in create'
app/controllers/orders_controller.rb:52:in `create'

I have looked at similar discussions on gmail configuration, using setup_mail.rb here and there, but wasn’t able to remove the error.

My config/environment.rb file (because i want same for dev/test/production)has my gmail details with xxxx and yyyyy:

 Depot::Application.configure do
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :address => "smtp.gmail.com",
    :port => 587,
    :domain => "gmail.com",
    :authentication => "plain",
    :user_name => "xxxxxx@gmail.com",
    :password => "yyyyyyy",
    :enable_starttls_auto => true
}
end

model/notifier/order_received.text.erb has this:

Dear <%= @order.name %>
Thank you for your recent order from The Pragmatic Store.
You ordered the following items:
<%= render @order.line_items %>
We'll send you a separate e-mail when your order ships.

and finally, models/controller/orders_controller has def create method with the line Notifier:

def create 
   @order = Order.new(params[:order]) 
   @order.add_line_items_from_cart(current_cart) 
   respond_to do |format| 
      if @order.save Cart.destroy(session[:cart_id]) 
          session[:cart_id] = nil 
          Notifier.order_received(@order).deliver 
          format.html { redirect_to(store_url, :notice => 'Thank you for your order.') }
      else 
          format.html { render :action => "new" } 
          format.xml { render :xml => @order.errors, :status => :unprocessable_entity }
      end 
   end 
end

I feel my email configuration was probably not done correctly, but not sure which one. Thanks!

EDIT: I managed to solve it! Instead of smtp i used sendmail.
As for the number of arguments error, the app/mailers/notifer.rb looks like this:

class Notifier < ActionMailer::Base
  default :from => 'Sam Ruby <depot@example.com>'

  def order_received(order)
    @order = order
    mail :to => order.email, :subject => 'Pragmatic Store Order Confirmation'
  end

  def order_shipped(order)
    @order = order
    mail :to => order.email, :subject => 'Pragmatic Store Order Shipped'
  end
end

Although my emails and everything still works, i’m curious whether anyones know why the smtp doesn’t work, and sendmail does.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:23:27+00:00Added an answer on May 22, 2026 at 3:23 pm

    You’ve got a space in your order_received definition:

    def order_received (order)
    

    That should be this:

    def order_received(order)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to send email from Microsoft Access unattended using VBA. I understand
Still learning JSP Web Applications here. I have been doing this for a while
I have only started learning Java. My task is to create a file server
I'm starting learning android development, so my knowledge is really limited at the moment.
I've just started learning Ruby on rails and I am wondering how to do
I've been learning android development and been trying to get the app on my
I've been learning android development and been trying to get the app on my
Learning WPF nowadays. Found something new today with .Net dependency properties. What they bring
Learning a little about T-SQL, and thought an interesting exercise would be to generate
Learning from my last question , most member names seem to get included in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.