小编Jef*_*ung的帖子

使用s3和雾上载Carrierwave

一直试图搜索这个错误的原因很长一段时间,似乎无法找到任何...

所以我有一个rails应用程序,我利用carrierwave来上传图片.我还想在我的应用程序中使用Amazon S3进行文件上传存储.

最初,当我开发应用程序时,我允许文件上传到on:文件,即

image_uploader.rb

# Choose what kind of storage to use for this uploader:
  storage :file
# storage :fog
Run Code Online (Sandbox Code Playgroud)

现在,在完成开发并将其置于实时(我使用heroku)后,我决定将载波存储更改为S3以在本地进行测试.

image_uploader.rb

# Choose what kind of storage to use for this uploader:
# storage :file
storage :fog
Run Code Online (Sandbox Code Playgroud)

但是,现在当我尝试上传图片(无论是用户头像等)时,我收到此错误:

Excon::Errors::Forbidden in UsersController#update
Expected(200) <=> Actual(403 Forbidden)
request => {:connect_timeout=>60, :headers=>{"Content-Length"=>74577, "x-amz-   acl"=>"private", "Content-Type"=>"image/png", "Date"=>"Sun, 26 Feb 2012 10:00:43 +0000",  "Authorization"=>"AWS AKIAJOCDPFOU7UTT4HOQ:8ZnOy7X71nQAM87yraSI24Y5bSw=", "Host"=>"s3.amazonaws.com:443"}, :instrumentor_name=>"excon", :mock=>false, :read_timeout=>60, :retry_limit=>4, :ssl_verify_peer=>true, :write_timeout=>60, :host=>"s3.amazonaws.com", :path=>"/uploads//uploads%2Fuser%2Favatar%2F1%2Fjeffportraitmedium.png", :port=>"443", :query=>nil, :scheme=>"https", :body=>"\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\xC2\x00\x00\x00\xC3\b\x06\x00\x00\x00\xD0\xBD\xCE\x94\x00\x00\nCiCCPICC Profile\x00\x00x\x01\x9D\x96wTSY\x13\xC0\xEF{/\xBD\xD0\x12B\x91\x12z\rMJ\x00\x91\x12z\x91^E%$\
...
# The code …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails heroku amazon-s3 carrierwave fog

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

Meteor页面使用Backbone路由器重新渲染

我正在尝试使用Meteor创建一个博客应用程序.在这个博客中有一个主页面,访问者只需阅读帖子,另一个部分是"管理员"面板,我可以在其中编辑帖子.我正在尝试使用车把模板助手,但我不确定我在哪里弄错了.我也是业余开发人员,并试图更好地学习Meteor框架.我的代码是这样的:

blog.html

<head>
  <title>Jeff Lam Tian Hung</title>
</head>

<body>
  <h1>Jeff Lam Tian Hung</h1>
  <a href="/" class="main">Main Page</a>
  <a href="/admin" class="admin">Admin</a>
  {{> content}}
</body>

<template name="content">
  {{#if currentPage "blog"}}
    {{#each posts}}
      <h2>{{Title}}</h2>
      <p>{{Body}}</p>
    {{/each}}
  {{/if}}

  {{#if currentPage "admin"}}
    <h2>{{admin}}</h2>
  {{/if}}
</template>
Run Code Online (Sandbox Code Playgroud)

blog.js

// Declaration of Collections
Posts = new Meteor.Collection("Posts");

// Helper variable is for pages
// TODO: changing this var will change the
// page but now how to rerender the page?
var page = "blog";

// Declaration of Template …
Run Code Online (Sandbox Code Playgroud)

html javascript javascript-framework handlebars.js meteor

3
推荐指数
1
解决办法
1826
查看次数