I want validate the file content of a paperclip attachment (https://github.com/thoughtbot/paperclip).
My model:
class PackageArchive < ActiveRecord::Base
attr_accessible :package
has_attached_file :package
validates_attachment :package,
:presence => true
validate :open
def open
Rails.logger.debug "####" + original_filename.inspect
file_content = `cat "#{package.path}"`
end
end
"cat" abort with error message "No such file or directory". It there a way to get the correct file name?