나는 3 개 파일 업로드 이미지가이 railcast에서 영감을 다단계 형태를 갖는다. 그러나 이미지를 업로드 할 때 오류 can't dump File
가 표시됩니다.클립 및 파일 업로드 문제
unless @post.valid?
@post.assets.first.attachment.clear
@post.assets.first.attachment.queued_for_write.clear
end
이 그러나 작동하지 않는 것 : 다른 질문에서
은 그래서 세션에서 파일 업로드를 절약이 같은 구약 사용 뭔가가 필요하므로 작동하지 않는 것으로 알고 있습니다. 3 가지 파일 업로드를 살펴보고 매번 삭제해야합니까? 이 오류를 피하려면 어떻게해야합니까? 여기
내 생성 기능입니다 :session[:post_params].deep_merge!(params[:post]) if params[:post]
session[:duration] = params[:post_duration] if params[:post_duration]
@post = Post.new(session[:post_params])
@post.current_step = session[:post_step]
unless @post.valid?
logger.info("attachment " + @post.assets.first.attachment.inspect)
@post.assets.first.attachment.clear
@post.assets.first.attachment.queued_for_write.clear
end
if @post.valid?
if params[:back_button]
@post.previous_step
elsif @post.last_step?
if @post.all_valid?
...
session[:post_step] = session[:post_params] = nil
redirect_to @post and return
end
else
@post.next_step
end
session[:post_step] = @post.current_step
end
if @post.new_record?
render "new"
end
end
내 자산 모델
class Asset < ActiveRecord::Base
# attr_accessible :title, :body
belongs_to :post
attr_accessible :attachment
has_attached_file :attachment, :styles => { :medium => "600x600>", :small => "200x200>", :thumb => "100x100>" },
:default_url => "no_image_:style.jpg"
end
저는이 점에 대해 많은 경험이 없으므로이 통찰력을 얻을 수 있습니다. (http://stackoverflow.com/questions/5876714/multi-step-form-in -rails-3-with-paperclip-attachments/8079113 # 8079113) –
@RichPeck 실제로 이미지 개체를 지우는 방법에 대한 제안을 발견했습니다. – Ayrad
도움이 될 수 있습니다. http://stackoverflow.com/questions/7079999/paperclipnotidentifiedbyimagemagickerrorimage -is-not-ident-by-the-ident/16933264 # 16933264 – Nithin