CarrierWave를 사용하여 스트라이프에 파일을 업로드 할 수 있도록 파일을 저장하려고하는데 오류가 발생합니다 :"유형 문자 변경 (255)에 너무 긴 값"오류를 수정하는 방법
ERROR: value too long for type character varying(255)
왜 내가 GitHub에서 CarrierWave 사용 안내서를 따라했는지 이해하지 못합니다.
class SplitterStripeServer < Sinatra::Base
CarrierWave.configure do |config|
config.root = File.dirname(__FILE__) + "/public"
end
post "/" do
img = Image.new
img.file = params[:file] #carrierwave will upload the file automatically
img.save!
redirect to("/")
end
get "/upload" do
erb :upload
end
get "/" do
@image = Image.find(1)
erb :index
end
end
이 업 로더는 다음과 같습니다 :
class Image
include DataMapper::Resource
property :id, Serial
mount_uploader :file, ImagesUploader
end
나는 단순한 뭔가 빠진 것 같은 기분 :
class ImagesUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
end
이 모델입니다
이
내 응용 프로그램입니다.
오류가 발생한 행 번호를 입력하면 도움이됩니다. – coletrain
죄송합니다.'image.save'를 호출 할 때 발생합니다. – Wazza
적절한 문법을 사용하시기 바랍니다. 구두점 및 철자법은 토론 목록이 아닌 온라인 참조 서인 Stack Overflow에서 중요합니다. –