fix set title. setting for heroku
This commit is contained in:
parent
5cf109280b
commit
c854b3d2e9
3 changed files with 9 additions and 4 deletions
1
.gems
1
.gems
|
@ -1,3 +1,4 @@
|
|||
authlogic
|
||||
carrierwave
|
||||
aws-s3
|
||||
mini_exiftool
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue