title: 'Template is missing' error in Rails 3.1 when trying to render
body: <p>I'm trying to use Ajax with my CRUD.  I'm following this <a href="http://stjhimy.com/posts/07-creating-a-100-ajax-crud-using-rails-3-and-unobtrusive-javascript" rel="nofollow noreferrer">tutorial</a>.</p>
  
  <p>I see this error:</p>
  
  <pre><code>Missing template posts/edit, application/edit with {:handlers=&gt;[:erb, :builder, :coffee], :formats=&gt;[:html], :locale=&gt;[:en, :en]}. Searched in: * "/Users/wangstabill/Code/rails/ajax_on_rails/app/views"
  </code></pre>
  
  <p>when I try to click the edit link.  It looks like:</p>
  
  <pre><code>&lt;%= link_to 'Edit', edit_post_path(post, remote: true) %&gt;
  </code></pre>
  
  <p>Now, I have a simple js.erb file located in app/views/posts/edit.js.erb.  This file is not used for a response.  Looking at the above error message, the :formats key's value is the array that only contains :html.  If I create a edit.html.js, this works fine but not the edit.js.erb file.</p>
  
  <p>This <a href="https://stackoverflow.com/questions/7101822/error-in-rails-3-1-using-js-jquery-template-is-missing">post</a> recommends removing the old rails.js file, but I'm quite sure I never included it in this simple app (or where to find it if I did).</p>
  
  <p>Here's what my controller class looks like:</p>
  
  <pre><code>class PostsController &lt; ApplicationController
      before_filter :load, :except =&gt; [:destroy, :create]
  
      def load
          @posts = Post.all
      end
  
      def index
          @post  = Post.new
      end
  
      def edit
          @post = Post.find(params[:id])
      end
  
      def create
          @post = Post.new(params[:post])
          if @post.save
              flash[:notice] = 'Post was successfully created.'
              load
          end
      end
  
      def update
          @post = Post.find(params[:id])
          if @post.update_attributes(params[:post])
              flash[:notice] = 'Post was successfully updated.'
          end
      end
  
      def destroy
          @post = Post.find(params[:id])
          @post.destroy
          flash[:notice] = 'Successfully destroyed post.'
          load
      end
  end
  </code></pre>
  
  <p>I don't understand why my create and destroy actions are successfully responding with js.erb templates, but not edit.  Thanks for any help!</p>