fix set title. setting for heroku
This commit is contained in:
parent
787912e735
commit
24e5a8c516
1
.gems
1
.gems
|
@ -1,3 +1,4 @@
|
||||||
authlogic
|
authlogic
|
||||||
carrierwave
|
carrierwave
|
||||||
aws-s3
|
aws-s3
|
||||||
|
mini_exiftool
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
ENV['PUBLIC'] = 'true'
|
ENV['PUBLIC'] = 'true'
|
||||||
ENV['TITLE'] = 'photos'
|
ENV['TITLE'] = 'photo'
|
||||||
#ENV['S3_KEY'] = ''
|
#ENV['HEROKU'] = 'true'
|
||||||
#ENV['S3_SECRET'] = ''
|
#ENV['S3_KEY'] = ''
|
||||||
#ENV['S3_BUCKET'] = ''
|
#ENV['S3_SECRET'] = ''
|
||||||
|
#ENV['S3_BUCKET'] = ''
|
Loading…
Reference in a new issue