title: ArgumentError (wrong number of arguments (3 for 0..1)):
body: <p>This is my model:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
  has_many :appointments
  has_many :doctors, :through =&gt; :appointments
  end
  
  class Doctor &lt; ActiveRecord::Base
  has_many :appointments
  has_many :users, :through =&gt; :appointments
  end
  
  class Appointment &lt; ActiveRecord::Base
  belongs_to :doctor
  belongs_to :user
  end
  </code></pre>
  
  <p>Code to call controller action:</p>
  
  <pre><code>$.ajax({
        type: "POST",
        url: "/create",
        data: {
          appointment_date: date,
          doctor_id: "1",
          user_id: "1"
        }
  </code></pre>
  
  <p>// Etc.
          });</p>
  
  <p>Action:</p>
  
  <pre><code>def create
  @appointment = Appointment.new(:appointment_date, :doctor_id, :user_id)
  if @appointment.save
      flash[:success] = "Welcome!"
      redirect_to @user
  else
      alert("failure!")
  end
  </code></pre>
  
  <p>And I got this error:</p>
  
  <pre><code>ArgumentError (wrong number of arguments (3 for 0..1)):
  </code></pre>
  
  <p>How to handle this error? Any advice? Thanks.</p>