Everyone: I already searched the error before I posted this to Stackoverflow, so no need to point me to this: groups.google.com/forum/?fromgroups=#!topic/carrierwave/ It's not the same problem.
I'm using Carrierwave so users can upload files to my Rackspace container. But when I Submit from my site (on my local machine, still in test mode), I get a Fog::Storage::Rackspace::NotFound app/controllers/authors_controller.rb:8:in `update' error. My Rackspace container is called kontainer.ofstuff. Here's my code:
pic_uploader.rb:
class PicUploader < CarrierWave::Uploader::Base
include Rails.application.routes.url_helpers
storage :fog
def store_dir
"#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
end
model author.rb
class Author < ActiveRecord::Base
attr_accessible :stuff, :profilepic
mount_uploader :pic, PicUploader
def dostuff
end
end
carrierwave.rb is in the config/initializers directory
CarrierWave.configure do |config|
config.storage = :fog
config.fog_credentials = {
:provider => 'Rackspace',
:rackspace_username => 'myusername',
:rackspace_api_key => '98765asecretnumber3'
})
config.fog_directory = 'kontainer.ofstuff'
config.fog_host = 'https://34567secretnumberiiiii.ssl.cf2.rackcdn.com'
end
controller authors_controller.rb
class AuthorsController < ApplicationController
def update
@author = Author.find(params[:id])
@booklist = Book.where(:author_id => @author.id)
#line 7
if @author.update_attributes(params[:author])
sign_in @author
redirect_to @author
else
render 'profileinfo'
end
end
end
edit.html.erb:
<%= f.file_field :pic %>
<%= f.submit "Save Author Info" %>
When I had this code 'uploading'/storing to a file, this worked fine. Perhaps f.submit does not work with Carrierwave? If not...where do I find the correct code for submitting?
Any ideas what the trouble is?