title: 405 Error when trying to POST a file in rails
body: <p>I am using paperclip gem to upload a file to the database. When I select the file I want to upload and go to create it, the next page should redirect_to root path. Instead, I get "Method Not Allowed" in my browser. I open Dev Tools and the console says:
  Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
  My logs look like: </p>
  
  <pre><code>Started POST "/assets" for ::1 at 2015-08-20 10:41:11 -0400
  </code></pre>
  
  <p>and remains hooked until I go back to another page.</p>
  
  <p>Here is my controller</p>
  
  <pre><code>class AssetsController &lt; ApplicationController
  # before_filter :authenticate_user!
  
  def index 
   @assets = current_user.assets      
  end
  
  def show 
   @asset = current_user.assets.find(params[:id]) 
  end
  
  def new
   @asset = current_user.assets.build
  end
  
  def create 
   @asset = current_user.assets.build(asset_params) 
    if @asset.save
     flash[:success] = "The file was uploaded!"
     redirect_to root_path
    else
     render 'new'
   end
  end
  
  def edit 
   @asset = current_user.assets.find(params[:id]) 
  end
  
  def update 
   @asset = current_user.assets.find(params[:id]) 
  end
  
  def destroy 
   @asset = current_user.assets.find(params[:id]) 
  end
  
  private
  
  def asset_params
   params.require(:asset).permit(:uploaded_file)
  
   end
  end
  </code></pre>
  
  <p>Here is my model:</p>
  
  <pre><code>class Asset &lt; ActiveRecord::Base
  belongs_to :user
  
  has_attached_file :uploaded_file
  
  validates_attachment_presence :uploaded_file
  validates_attachment_size :uploaded_file, less_than: 10.megabytes   
  end
  </code></pre>
  
  <p>And I am using the simple_form gem to submit the file:</p>
  
  <pre><code>&lt;%= simple_form_for @asset, :html =&gt; {:multipart =&gt; true} do |f| %&gt; 
   &lt;% if @asset.errors.any? %&gt;
    &lt;ul&gt;
     &lt;% @asset.errors.full_messages.each do |msg|%&gt;
      &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;
     &lt;/ul&gt; 
   &lt;% end %&gt;
  &lt;% end %&gt;
  &lt;p&gt; 
  &lt;%= f.input :uploaded_file %&gt; 
  &lt;/p&gt; 
  &lt;p&gt;
  &lt;%= f.button :submit, class: "btn btn-primary" %&gt;
  &lt;/p&gt; 
  &lt;% end %&gt;
  </code></pre>
  
  <p>The 405 error indicates that I am doing a request not supported by the Asset model. I have resources :assets in my config routes file and when I run rake routes, all of my RESTful routes are there. </p>
  
  <p>I would appreciate any help on this one.</p>