1
我正在尝试使用MiniExiftool的Paperclip。更新时无参考
我终于写了这个:
# 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
我得到:
Mysql::Error: Column 'user_id' cannot be null ...
没有保存!一切正常,但self.date保持为空(即使exif ['date_time_original']不为空)。
我真的很沮丧。我怎样才能让Paperclip与MiniExiftool一起工作?