I am trying to get Paperclip working with MiniExiftool.
I finally wrote this:
# Photo model
belongs_to :user
has_attached_file :picture
after_picture_post_process :copy_exif_data
private
def copy_exif_data
exif = MiniExiftool.new picture.queued_for_write[:original].path
self.date = exif['date_time_original']
save!
end
I get:
Mysql::Error: Column 'user_id' cannot be null ...
Without save! all works well, but self.date remains null (even if exif['date_time_original'] is NOT null).
I am really frustrated. How can I get Paperclip working with MiniExiftool?