Switching to Grid_FS, correctly

This commit is contained in:
ilya 2010-07-23 14:52:59 -07:00
parent 283bbc4850
commit 1b32afc78f
3 changed files with 9 additions and 9 deletions

View file

@ -2,7 +2,7 @@ class PhotosController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
def create def create
begin #begin
@photo = Photo.instantiate(params[:photo]) @photo = Photo.instantiate(params[:photo])
@photo.person = current_user @photo.person = current_user
@ -16,10 +16,10 @@ class PhotosController < ApplicationController
render :action => 'album#new' render :action => 'album#new'
end end
rescue #rescue
flash[:error] = "Photo upload failed. Are you sure that was an image?" # flash[:error] = "Photo upload failed. Are you sure that was an image?"
redirect_to Album.first(:id => params[:photo][:album_id]) # redirect_to Album.first(:id => params[:photo][:album_id])
end #end
end end
def new def new

View file

@ -4,7 +4,7 @@ class ImageUploader < CarrierWave::Uploader::Base
storage :grid_fs storage :grid_fs
def store_dir def store_dir
"uploads" "files/#{model.id}"
end end
def extension_white_list def extension_white_list

View file

@ -1,7 +1,7 @@
CarrierWave.configure do |config| CarrierWave.configure do |config|
#config.grid_fs_database = "#diaspora-#{Rails.env}" config.grid_fs_database = "#diaspora-#{Rails.env}"
#config.grid_fs_host = 'localhost' config.grid_fs_host = 'localhost'
#config.grid_fs_access_url = "/images" config.grid_fs_access_url = "/images"
config.storage = :grid_fs config.storage = :grid_fs
#config.storage = :file #config.storage = :file
end end