클립 클립을 사용하여 ajax를 통해 이미지를 업로드하려고합니다.클립 클립 중복 URL 오류
아약스 항목에 대해 qqfileuploader를 사용하고 있는데 게시 요청에 대한 매개 변수 이름을 정의 할 수있는 옵션이없는 것 같습니다. 아약스 게시물에서 보낸
매개 변수는 사진에
qqfile=filename.jpg
나의 모델에서, 나는 별명이있다 qqfile
입니다alias_attribute :qqfile, :photo has_attached_file :photo attr_accessible :title, :photo
내가 아약스를 통해 파일을 업로드 할 때, 나는 다음과 같은 오류를 얻을 수
Parameters: {"qqfile"=>"Penguins.jpg"} WARNING: Can't verify CSRF token authenticity Creating scope :page. Overwriting existing method User.page. User Load (1.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1 Creating scope :page. Overwriting existing method RoleUser.page. Creating scope :page. Overwriting existing method Role.page. Role Load (1.4ms) SELECT `roles`.* FROM `roles` INNER JOIN `role_users` ON `roles`.`id` = `role_users`.`role_id` WHERE `role_users`.`user_id` = 1 SQL (0.7ms) BEGIN Creating scope :page. Overwriting existing method Task.page. [paperclip] Duplicate URL for photo with /system/:attachment/:id/:style/:filename. This will clash with attachment defined in Recipe class
CSRF 토큰이 문제가되는지, 페이지에 토큰이 있는지 확실하지 않습니다. 아마 어쩌면 그저 보낼 필요가 있습니다, 나는 그것이 자바 스크립트 변수가 될 수 있다고 가정합니까?
하지만 중복 된 URL은 무엇입니까? 정확하게 앨리어싱하지 않습니까? 어떤 이유로 클립 클립 객체의 별명을 지정할 수 있습니까?
내 컨트롤러는
def create @recipe = Recipe.new(params[:recipe]) @recipe.author_id=current_user.id if @recipe.save return render :json => @recipe else return render :text => 'an error occured saving the recipe' end end
'has_attached_file'의 정확한 호출을 (모든) 제공 할 수 있습니까? – moritz
@mosch, has_attached_file과 attr_accessible을 추가했습니다. 이것은 내가 아는 한 기본 사항입니다. – pedalpete