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 authlogic
carrierwave carrierwave
aws-s3 aws-s3
mini_exiftool

View file

@ -12,8 +12,8 @@ class Photo < ActiveRecord::Base
validates_presence_of :title validates_presence_of :title
before_validation :set_title before_validation :set_title
before_create :exif_read #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_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_accessor :tag_list
#attr_protected :path #attr_protected :path
@ -55,7 +55,7 @@ class Photo < ActiveRecord::Base
def exif_info def exif_info
photo = MiniExiftool.new(self.path_original) photo = MiniExiftool.new(self.file.path)
#photo.tags.sort.each do |tag| #photo.tags.sort.each do |tag|
# puts tag.ljust(28) + photo[tag].to_s # puts tag.ljust(28) + photo[tag].to_s
#end #end
@ -68,7 +68,7 @@ class Photo < ActiveRecord::Base
private private
def set_title def set_title
self.title = self.file.filename.titleize unless self.title self.title = self.file.file.basename.titleize unless self.title
end end
def ensure_file def ensure_file

View file

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

View file

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