Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery File Upload v4 for Rails 3, Routing Error
    primarykey
    data
    text
    <p>I was following this <a href="https://github.com/blueimp/jQuery-File-Upload/wiki/jQuery-File-Upload-v4-for-Rails-3" rel="nofollow">tutorial</a> and ran into difficulties.</p> <p>I get the Routing Error by calling <code>http://localhost:3000/home</code> Maybe I am just calling the wrong page. I would grateful if somebody helps me.</p> <p><br> Hier is my routes.rb:</p> <pre><code>Try::Application.routes.draw do resources :uploads root :to =&gt; "home#index" end </code></pre> <p><br> uploads_controller.rb:</p> <pre><code>class UploadsController &lt; ApplicationController def home end def index end def create @upload = Upload.new(params[:upload]) if @upload.save render :json =&gt; { :pic_path =&gt; @upload.picture.url.to_s , :name =&gt; @upload.picture.instance.attributes["picture_file_name"] }, :content_type =&gt; 'text/html' else render :json =&gt; { :result =&gt; 'error'}, :content_type =&gt; 'text/html' end end end </code></pre> <p>and views/home/index.html.erb:</p> <pre><code>&lt;%= stylesheet_link_tag('jquery.fileupload-ui') %&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;%= javascript_include_tag 'jquery.fileupload', 'jquery.fileupload-ui' %&gt; &lt;script type="text/javascript" charset="utf-8"&gt; $(function () { $('.upload').fileUploadUI({ uploadTable: $('.upload_files'), downloadTable: $('.download_files'), buildUploadRow: function (files, index) { var file = files[index]; return $('&lt;tr&gt;&lt;td&gt;' + file.name + '&lt;\/td&gt;' + '&lt;td class="file_upload_progress"&gt;&lt;div&gt;&lt;\/div&gt;&lt;\/td&gt;' + '&lt;td class="file_upload_cancel"&gt;' + '&lt;button class="ui-state-default ui-corner-all" title="Cancel"&gt;' + '&lt;span class="ui-icon ui-icon-cancel"&gt;Cancel&lt;\/span&gt;' + '&lt;\/button&gt;&lt;\/td&gt;&lt;\/tr&gt;'); }, buildDownloadRow: function (file) { return $('&lt;tr&gt;&lt;td&gt;&lt;img alt="Photo" width="40" height="40" src="' + file.pic_path + '"&gt;' + file.name + '&lt;\/td&gt;&lt;\/tr&gt;'); }, }); }); &lt;/script&gt; &lt;div class="files"&gt; &lt;%= form_for @upload, :html =&gt; { :class =&gt; "upload", :multipart =&gt; true } do |f| %&gt; &lt;%= f.file_field :picture %&gt; &lt;div&gt;Upload files&lt;/div&gt; &lt;% end %&gt; &lt;table class="upload_files"&gt;&lt;/table&gt; &lt;table class="download_files"&gt;&lt;/table&gt; &lt;/div&gt; </code></pre> <p>home_controller.rb:</p> <pre><code>class HomeController &lt; ApplicationController def index @upload = Upload.new end end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload