我正在尝试按照此示例使用 jquery 拖放上传器
https://github.com/jalagrange/bootstrap_uploader
我的观点:
<%= form_for @object_new, :html => { :multipart => true, :id => "fileupload" } do |f| %>
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
<div class="row fileupload-buttonbar">
<div class="span7">
<!-- The fileinput-button span is used to style the file input field as 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">
<!-- The global progress bar -->
<div class="progress progress-success progress-striped active fade">
<div class="bar" style="width:0%;"></div>
</div>
</div>
</div>
<!-- The loading indicator is shown during image processing -->
<div class="fileupload-loading"></div>
<br>
<!-- The table listing the files available for upload/download -->
<table class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody>
</table>
<% end %>
控制器:
def upload
@object_new= Property::File.new
end
模型:
class Property::File < ActiveRecord::Base
attr_accessible :date, :description, :location, :name, :time ,:path
end
架构:
create_table "property_files", :force => true do |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
路线.rb
root :to => "property#home"
get "property/home"
get "property/upload"
当我运行我的视图时,我收到了这个错误:
NoMethodError in Property#upload
Showing C:/myproject/app/views/property/upload.html.erb where line #71 raised:
undefined method `property_files_path' for #<#<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" } do |f| %>
72: <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
73: <div class="row fileupload-buttonbar">
74: <div class="span7">
Rails.root: C:/myproject
我不明白在哪里property_files_path
使用。
谢谢你的帮助