Search code examples
herokurackspace

Can't get carrierwave to work with Rackspace via heroku


My app was working totally fine on heroku before I installed carrierwave and tried to set up rackspace. I followed the instruction provided on the gem but it didn't help me setting up my app.

I am hosting my website on heroku, I have a rackspace cloudfile account and I am using carrier wave right now. config > initializer carrierwave.

I set up the initializer:

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

App Uploaders ? image_uploader.rb

include Sprockets::Helpers::RailsHelper include Sprockets::Helpers::IsolatedHelper

# Choose what kind of storage to use for this uploader: # storage :file storage :fog

# Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end

I am gettingg the following error message when I try to access my hap via the browser:

ActionView::Template::Error ( isn't precompiled):

    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

Solution

  • I fixed this issue. I created a folder 'karat' on Rackspace then I precompiled my asset and it is now working fine.