title: Gettin 500 Internal Server Error in rails on ajax request
body: <p>I'm trying to create a record from a form. I've used railscast 136 as ground work. When I trying to submit I get a 500 error for missing partial. I've created the controller correlated javascript view but it is requesting a view with the same name as the model.</p>
  
  <p><strong>error message</strong></p>
  
  <blockquote>
    <p>Rendered appointments/create.js.erb (3.8ms) Completed 500 Internal
    Server Error in 12ms</p>
    
    <p>ActionView::Template::Error (Missing partial appointments/appointment
    with {:locale=>[:en], :formats=>[:js, :html], :handlers=>[:erb,
    :builder, :coffee]}. Searched in:   *
    "/Users/gjores/Sites/Rails/verkstad_test/app/views" ):
        1: $('#appointments').append('&lt;%= j render(@appointment) %>');   app/views/appointments/create.js.erb:1:in
    <code>_app_views_appointments_create_js_erb___2325925946390315228_70273089113920'
    app/controllers/appointments_controller.rb:16:in</code>create'</p>
  </blockquote>
  
  <p><strong>Controller</strong></p>
  
  <pre><code> def create
      @appointment = Appointment.new(params[:appointment])
      if @appointment.save
        respond_to do |format|
          format.html { redirect_to new_appointment_path, :notice =&gt; "Successfully created appointment." }
          format.js
        end
      else
        render :action =&gt; 'new'
      end
    end
  </code></pre>
  
  <p><strong>appointments/new.html.erb</strong></p>
  
  <pre><code>&lt;div id="appointments"&gt;
      &lt;%= render 'shared/appointment_part' %&gt;
  &lt;/div&gt;
  &lt;% title "New Appointment" %&gt;
  &lt;table&gt;
  &lt;% @students.each do |s| %&gt;
  &lt;%= form_for @appointment,  :remote =&gt; true do |f|%&gt;
    &lt;%= f.error_messages %&gt;
    &lt;tr&gt;  
      &lt;td&gt;&lt;%= s.name %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= f.label :week %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= f.number_field :week %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= f.label :teacher_id %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%= f.collection_select(:teacher_id, Teacher.all, :id, :name) %&gt;&lt;/td&gt;
      &lt;%= f.hidden_field :student_id, :value =&gt; s.id %&gt;
  
    &lt;td&gt;&lt;%= f.submit %&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;% end %&gt;
  &lt;% end -%&gt;
  &lt;/table&gt;
  
  &lt;p&gt;&lt;%= link_to "Back to List", appointments_path %&gt;&lt;/p&gt;
  </code></pre>
  
  <p><strong>appointments/create.js.erb</strong></p>
  
  <pre><code>$('#appointments').append('&lt;%= j render(@appointment) %&gt;');
  </code></pre>
  
  <p><strong>Routes</strong></p>
  
  <pre><code>    appointments GET    /appointments(.:format)          appointments#index
                   POST   /appointments(.:format)          appointments#create
   new_appointment GET    /appointments/new(.:format)      appointments#new
  edit_appointment GET    /appointments/:id/edit(.:format) appointments#edit
       appointment GET    /appointments/:id(.:format)      appointments#show
                   PUT    /appointments/:id(.:format)      appointments#update
                   DELETE /appointments/:id(.:format)      appointments#destroy
          teachers GET    /teachers(.:format)              teachers#index
                   POST   /teachers(.:format)              teachers#create
       new_teacher GET    /teachers/new(.:format)          teachers#new
      edit_teacher GET    /teachers/:id/edit(.:format)     teachers#edit
           teacher GET    /teachers/:id(.:format)          teachers#show
                   PUT    /teachers/:id(.:format)          teachers#update
                   DELETE /teachers/:id(.:format)          teachers#destroy
   notice_students POST   /students/notice(.:format)       students#notice
          students GET    /students(.:format)              students#index
                   POST   /students(.:format)              students#create
       new_student GET    /students/new(.:format)          students#new
      edit_student GET    /students/:id/edit(.:format)     students#edit
           student GET    /students/:id(.:format)          students#show
                   PUT    /students/:id(.:format)          students#update
                   DELETE /students/:id(.:format)          students#destroy
  </code></pre>