search for: validates_file_format_of

Displaying 7 results from an estimated 7 matches for "validates_file_format_of".

2007 Dec 27
4
validates_file_format_of only when is there an image
i have a model with this: file_column :image validates_file_format_of :image, :in => ["gif", "png", "jpg"] If inthe form the user not insert the image i receive an error. If i remove: validates_file_format_of :image, :in => ["gif", "png", "jpg"] it works. Is possible do the validation only when user...
2006 Apr 25
3
limiting options in file_upload
Does anyone know if it''s possible to set constraints to the size & type of file that file_column will accept? I''d like to limit to image files of less than 2MB. If this isn''t possible with file_column, is there a graceful way of getting the controller to handle it? thanks dorian -- -- I do things for love or money
2006 Jan 11
1
fiile_column persistent across different forms
...------- <% if @post["image"] %> <%= image_tag url_for_file_column("post", "image") %> <br><br <% end %> and in my model i do file_column :image, :magick => { :geometry => "320x240" } validates_file_format_of :image, :in => ["image/jpeg"] validates_filesize_of :image, :in => 0.kilobytes..50.kilobytes does anybody see what I am missing here ? thanks adam
2006 Jul 30
1
FileColumn - Validate Before Saving
file_column is great -- but I need a way to run through the validations (ie: validates_file_format_of) before saving. That is, when a user first uploads an image it is displayed in the view but not ''saved'' until they click the ''Save'' button on the form. I want to display an error message/disable the ''Save'' button if the file they just uploade...
2007 Feb 01
2
file_column 2nd try....
...xt] @image = Image.new(args[:image]) @image.dimensions @image.save end def progress results[:progress] end end ImageWorker.register image.rb require ''RMagick'' class Image < ActiveRecord::Base belongs_to :user validates_filesize_of :image, :in => 15.kilobytes..1.megabyte validates_file_format_of :image, :in => ["gif", "png", "jpg"] file_column :image, :magick => {:versions => {"thumb" => "150x100", "picture" => "600x450>"}} def dimensions img = Magick::Image.read(self.image).first if img.columns >...
2007 Oct 24
0
STI vs CTI vs something else?...
Hey gang, I have these classes: class Image < UploadFile validates_file_format_of :filename, :in => ["gif", "png", "jpg"] end class UploadFile < PropertyItem file_column :filename validates_presence_of :filename end class PropertyItem < ActiveRecord::Base validates_presence_of :name end What I''m trying to achieve is a clas...
2006 May 04
5
How to upload only jpeg & gif & png images into public/images using rubyonrails
Hello iam new to rubyonrails. Please any one help me out in "How to upload only jpeg & gif & png images into public/images using rubyonrails" Thanks in Advance -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060504/33a17ad2/attachment.html