小编p1n*_*nox的帖子

301 S3上传后永久移动

我试图使用carrierwave和雾宝石将图像上传到Ruby on Rails上的S3,正确上传图像但是当我尝试保存包含刚刚上传的图像信息的模型时我得到了这个错误:

Excon::Errors::MovedPermanently in UserController#show
app/models/user.rb:46:in `process_image_with_key'
app/controllers/user_controller.rb:12:in `show'

<Excon::Response:0x007f97846a3c18 @body="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error><Code>PermanentRedirect</Code><Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
Run Code Online (Sandbox Code Playgroud)

用户模型:

mount_uploader :image, AvatarUploader

def image_name
  File.basename(image.path || image.filename) if image
end

def process_image_with_key( key )
  unless key.nil?
    self.key = key
    self.remote_image_url = self.image.direct_fog_url(with_path: true)
    self.save!
  end
end
Run Code Online (Sandbox Code Playgroud)

AvatarUploader:

# encoding: utf-8

class AvatarUploader < CarrierWave::Uploader::Base

  include CarrierWaveDirect::Uploader

  include CarrierWave::RMagick

  # Include the Sprockets helpers …
Run Code Online (Sandbox Code Playgroud)

ruby amazon-s3 carrierwave fog ruby-on-rails-3.2

12
推荐指数
1
解决办法
2万
查看次数

当前osx-64和通道中缺少的软件包

尝试使用文件重新创建环境后,我收到此错误: Error: Packages missing in current osx-64 channels: - timbr-io::argh 0.26.1 py27_0 - timbr-io::pathtools 0.1.2 py27_0 - timbr-io::watchdog 0.8.3 py27_0

并且在docker容器上运行这些命令时出现同样的错误. Error: Packages missing in current linux-64 channels: - timbr-io::argh 0.26.1 py27_0 - timbr-io::pathtools 0.1.2 py27_0 - timbr-io::watchdog 0.8.3 py27_0

这是我用作源的文件: name: snowflakes dependencies: - boto3=1.3.1=py27_0 - botocore=1.4.28=py27_0 - docutils=0.12=py27_2 - ecdsa=0.13=py27_0 - futures=3.0.5=py27_0 - jmespath=0.9.0=py27_0 - openssl=1.0.2h=1 - paramiko=1.16.0=py27_0 - pip=8.1.2=py27_0 - pycrypto=2.6.1=py27_4 - python=2.7.12=1 - python-dateutil=2.5.3=py27_0 - pyyaml=3.11=py27_4 - readline=6.2=2 - setuptools=23.0.0=py27_0 - six=1.10.0=py27_0 - sqlite=3.13.0=0 - timbr-io::argh=0.26.1=py27_0 …

python anaconda conda miniconda

7
推荐指数
1
解决办法
7280
查看次数