【发布时间】:2012-04-19 23:22:26
【问题描述】:
在我安装 carrierwave 并尝试设置 rackspace 之前,我的应用在 heroku 上运行良好。我按照 gem 上提供的说明进行操作,但它并没有帮助我设置我的应用程序。
我在 heroku 上托管我的网站,我有一个 rackspace cloudfile 帐户,我现在正在使用载波。 配置 > 初始化载波。
我设置了初始化器:
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'Rackspace',
:rackspace_username => 'my_id',
:rackspace_api_key => 'my_api_key'
}
config.fog_directory = 'karet'
config.fog_host = "http://c000000.cdn.rackspacecloud.com"
end
应用上传者? image_uploader.rb
包括 Sprockets::Helpers::RailsHelper 包括 Sprockets::Helpers::IsolatedHelper
# 选择此上传器使用的存储类型: # 存储:文件 存储:雾
# 覆盖上传文件的存储目录。 # 对于要挂载的上传者来说,这是一个明智的默认设置: def store_dir “上传/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}” 结束
当我尝试通过浏览器访问我的 hap 时,我收到以下错误消息:
ActionView::Template::Error(未预编译):
30: <tr>
31: <td>
32: <% if karretlink.link == "" %>
33: <%= image_tag(karretlink.link) %>
34: <% else %>
35: <% if karretlink.kind == 'video' %>
36: <%= youtube_preview_embed(karretlink.link) %>
app/views/karretlinks/index.html.erb:33:in `block in _app_views_karretlinks_index_html_erb___2945645007174033048_34354840'
app/views/karretlinks/index.html.erb:29:in `each'
app/controllers/karretlinks_controller.rb:16:in `index'
app/views/karretlinks/index.html.erb:29:in `_app_views_karretlinks_index_html_erb___2945645007174033048_34354840'
cache: [GET /] miss
【问题讨论】:
-
我解决了这个问题。我在 Rackspace 上创建了一个文件夹“karat”,然后我预编译了我的资产,它现在工作正常。