Switching to Grid_FS, correctly
This commit is contained in:
parent
283bbc4850
commit
1b32afc78f
3 changed files with 9 additions and 9 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue