我使用carrierwave_direct上传文件,但当上传的文件为空时我遇到了这样的错误:
<Error><Code>EntityTooSmall</Code><Message>Your proposed upload is smaller than the minimum allowed size</Message><MinSizeAllowed>1</MinSizeAllowed><ProposedSize>0</ProposedSize><RequestId>FE2FE66371A06E29</RequestId><HostId>k3aJ8EtnmPvVxJszZukKYbtEO5Ddrjq/a+FdhqTyL1nZ7afy+msTAA1MiwX8lXvH</HostId></Error>
如何捕获此异常? 我的代码:
collection_action :new_import do
@uploader = @organization.import_file
@organization.save
@uploader.success_action_redirect = import_admin_organization_rooms_url(@organization)
end
collection_action :import do
RoomImportWorker.perform_async(params[:bucket],params[:key],@organization.id,current_user.id)
redirect_to admin_organization_rooms_path(@organization), :notice => "Your request has been accepted! We will inform you via email about the results!"
end
答案 0 :(得分:0)