At the moment I try to replace attachment_fu fileuploading plugin with paperclip.
But there are some errors while uploading:
My controller looks like this:
def create
add_breadcrumb 'breadcrumb.upload_file', {:action => :new}
puts "BLUBBBBBBBBBBBBBBBBBBBBBBBBBBB"
puts params[:upload]
@upload = Upload.create(params[:upload])
@upload.lecturer_id = current_user.id
if @upload.save
flash[:notice] = I18n.t("flash.saved")
redirect_to :action => :index
else
render :action => :new
end
end
and my model like this:
puts has_attached_file :image, :default_url => :file_system
validates_attachment_content_type :image, :content_type => [:image, 'audio/mpeg', 'application/mp3', 'application/octet-stream']
While uploading I got this error:
ActiveRecord::UnknownAttributeError in UploadsController#create
unknown attribute: uploaded_data
app/controllers/uploads_controller.rb:24:in `create'
Aucun commentaire:
Enregistrer un commentaire