fix set title. setting for heroku

This commit is contained in:
Espen Antonsen 2010-04-14 01:00:48 -04:00
parent 787912e735
commit 24e5a8c516
4 changed files with 14 additions and 8 deletions

1
.gems
View file

@ -1,3 +1,4 @@
authlogic
carrierwave
aws-s3
mini_exiftool

View file

@ -12,8 +12,8 @@ class Photo < ActiveRecord::Base
validates_presence_of :title
before_validation :set_title
before_create :exif_read
before_update :exif_write # should only write if tags are changed as images can be large and thus ExifTool will take a while to write to the file
#before_create :exif_read
#before_update :exif_write # should only write if tags are changed as images can be large and thus ExifTool will take a while to write to the file
attr_accessor :tag_list
#attr_protected :path
@ -55,7 +55,7 @@ class Photo < ActiveRecord::Base
def exif_info
photo = MiniExiftool.new(self.path_original)
photo = MiniExiftool.new(self.file.path)
#photo.tags.sort.each do |tag|
# puts tag.ljust(28) + photo[tag].to_s
#end
@ -68,7 +68,7 @@ class Photo < ActiveRecord::Base
private
def set_title
self.title = self.file.filename.titleize unless self.title
self.title = self.file.file.basename.titleize unless self.title
end
def ensure_file

View file

@ -10,6 +10,10 @@ class FileUploader < CarrierWave::Uploader::Base
#storage :file
if ENV['S3_KEY']
storage :s3
def cache_dir
"#{RAILS_ROOT}/tmp/uploads" if ENV['HEROKU'] == 'true'
end
else
storage :file
end

View file

@ -1,5 +1,6 @@
ENV['PUBLIC'] = 'true'
ENV['TITLE'] = 'photos'
#ENV['S3_KEY'] = ''
#ENV['S3_SECRET'] = ''
#ENV['S3_BUCKET'] = ''
ENV['TITLE'] = 'photo'
#ENV['HEROKU'] = 'true'
#ENV['S3_KEY'] = ''
#ENV['S3_SECRET'] = ''
#ENV['S3_BUCKET'] = ''