Created
August 20, 2009 08:00
-
-
Save jugyo/170901 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add a utility method 'set_file' | |
module Technoweenie | |
module AttachmentFu | |
module InstanceMethods | |
def set_file(path, content_type = Mime::TEXT) | |
raise ArgumentError, "No such file - #{path}" unless File.exists?(path) | |
self.filename = File.basename(path) | |
self.content_type = content_type | |
set_temp_data File.read(path) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment