From 2487ca887d56eb2118c08d1a7cfb60b076ea855d Mon Sep 17 00:00:00 2001 From: Espen Antonsen Date: Mon, 11 Apr 2011 15:53:51 +0800 Subject: [PATCH] path no longer in use for photos. can get absolute path from file --- app/models/photo.rb | 4 ++-- app/views/photos/_form.html.erb | 2 +- db/migrate/20110411074351_remove_path_from_photos.rb | 8 ++++++++ db/schema.rb | 3 +-- 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20110411074351_remove_path_from_photos.rb diff --git a/app/models/photo.rb b/app/models/photo.rb index c560df7..a68d8cf 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -70,7 +70,7 @@ class Photo < ActiveRecord::Base end def exif_read - photo = MiniExiftool.new(self.file.path) + photo = MiniExiftool.new(self.file.file.file) self.longitude = photo.GPSLongitude if self.longitude.nil? self.latitude = photo.GPSLatitude if self.latitude.nil? self.title = photo.DocumentName if self.title.nil? @@ -80,7 +80,7 @@ class Photo < ActiveRecord::Base def 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 - photo = MiniExiftool.new(self.path.file) + photo = MiniExiftool.new(self.file.file.file) photo.GPSLongitude = self.longitude photo.GPSLatitude = self.latitude photo.DocumentName = self.title diff --git a/app/views/photos/_form.html.erb b/app/views/photos/_form.html.erb index b087a6c..f21f7db 100644 --- a/app/views/photos/_form.html.erb +++ b/app/views/photos/_form.html.erb @@ -11,4 +11,4 @@ <%= form.label :description %>
<%= form.text_area :description %>

-

On disk: ~/<%= @photo.path %>

\ No newline at end of file +

On disk: ~/<%= @photo.file.file.file %>

\ No newline at end of file diff --git a/db/migrate/20110411074351_remove_path_from_photos.rb b/db/migrate/20110411074351_remove_path_from_photos.rb new file mode 100644 index 0000000..6b0934d --- /dev/null +++ b/db/migrate/20110411074351_remove_path_from_photos.rb @@ -0,0 +1,8 @@ +class RemovePathFromPhotos < ActiveRecord::Migration + def self.up + remove_column :photos, :path + end + + def self.down + end +end diff --git a/db/schema.rb b/db/schema.rb index aab31aa..409f5b0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20100412220801) do +ActiveRecord::Schema.define(:version => 20110411074351) do create_table "albums", :force => true do |t| t.string "title", :null => false @@ -70,7 +70,6 @@ ActiveRecord::Schema.define(:version => 20100412220801) do t.integer "album_id" t.datetime "created_at" t.datetime "updated_at" - t.text "path" t.float "longitude" t.float "latitude" t.string "file"