ruby - Rails: why this weird error -


i trying use jquery drag , drop uploader following example

https://github.com/jalagrange/bootstrap_uploader

my view:

   <%= form_for @object_new, :html => { :multipart => true, :id => "fileupload"  } |f| %>         <!-- fileupload-buttonbar contains buttons add/delete files , start/cancel upload -->         <div class="row fileupload-buttonbar">           <div class="span7">             <!-- fileinput-button span used style file input field button -->                 <span class="btn btn-success fileinput-button">                     <i class="icon-plus icon-white"></i>                     <span>add files...</span>                   <%= f.file_field :path, :multiple => true %>                 </span>             <button type="submit" class="btn btn-primary start">               <i class="icon-upload icon-white"></i>               <span>start upload</span>             </button>             <button type="reset" class="btn btn-warning cancel">               <i class="icon-ban-circle icon-white"></i>               <span>cancel upload</span>             </button>             <button type="button" class="btn btn-danger delete">               <i class="icon-trash icon-white"></i>               <span>delete</span>             </button>             <input type="checkbox" class="toggle">           </div>           <div class="span5">             <!-- global progress bar -->             <div class="progress progress-success progress-striped active fade">               <div class="bar" style="width:0%;"></div>             </div>           </div>         </div>         <!-- loading indicator shown during image processing -->         <div class="fileupload-loading"></div>         <br>         <!-- table listing files available upload/download -->         <table class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody>         </table>     <% end %> 

controller:

 def upload        @object_new= property::file.new    end 

model:

class property::file < activerecord::base   attr_accessible :date, :description, :location, :name, :time ,:path end 

schema:

  create_table "property_files", :force => true |t|     t.string   "name"     t.string   "description"     t.string   "date"     t.datetime "time"     t.string   "location"     t.datetime "created_at",  :null => false     t.datetime "updated_at",  :null => false     t.string   "path"   end 

routes.rb

  root :to => "property#home"     "property/home"   "property/upload" 

when run view got error:

nomethoderror in property#upload  showing c:/myproject/app/views/property/upload.html.erb line #71 raised:  undefined method `property_files_path' #<#<class:0x563d3a8>:0x563b5a8> extracted source (around line #71):  68:     </div><!--/span--> 69:     <div class="span9"> 70:  71:     <%= form_for @object_new, :html => { :multipart => true, :id => "fileupload"  } |f| %> 72:         <!-- fileupload-buttonbar contains buttons add/delete files , start/cancel upload --> 73:         <div class="row fileupload-buttonbar"> 74:           <div class="span7"> rails.root: c:/myproject 

i don't understand property_files_path being used in view.

thanks help

it's being called form generator. work want add:

resources :property_files 

... routes.

if not want form default resourceful routes, can specify own path upload action passing url option form_for, example:

<% form_for @object_new, {:url => "/property_files/upload", ... } %> 

Comments