This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
SavingImages
Usage
These assignment methods can be used in two ways. First they can be called directly.
my_photo.image_file = File.new('path/to/file.png', 'rb')
Or they can be called via mass assignment.
Photo.new(:image_file => File.new('path/to/file.png', 'rb')
Photo.new(params[:photo]) #where params[:image_file] is an uploaded image
Assignment methods
image_file = file
This is the most common assignment method. This will work with an instance of any IO object, such as File or StringIO. it will also work with file upload fields in your forms.
image_file_url = url
Fetches an image from a url on the internet and saves it with the record.
image_file_string = file_data
Reads the image from a string of file data. This can be used with the result of something like File.read('my_image.jpg', 'rb').
image_file_base64 = base64_data
Reads the image from a string of base64 encoded file data.
image_file_temp = temp_file_name
This one is used internally to make forms redisplay safe. It expects the named of a file in your apps tmp directory. You probably shouldn’t need to use this one.






