title: Problem rendering vanilla JavaScript in Ruby
body: <p>In My controller I am trying to render vanilla JavaScript but am getting an unexpected result. This is the code</p>
  
  <pre><code>class UploadController &lt; ApplicationController
  
      def index
  
          render :file =&gt; 'app\views\upload\uploadfile.rhtml'
  
      end
  
      def uploadFile
  
          render :js =&gt; "alert('Hello Rails');"
  
         post = DataFile.save(params[:upload])
  
      end
  
  end
  </code></pre>
  
  <p>Am expecting before executing post = DataFile.save(params[:upload]) I should see a alertbox but I am seeing a download box. What could be the problem?</p>