similar to: How do I validate using associated objects?

Displaying 16 results from an estimated 16 matches similar to: "How do I validate using associated objects?"

2006 Jul 22
7
Validation with has_many
I have two problems. I have a comment that has_many uploads. Before saving the comment, I want to be sure that the upload(s) has passed validation, but I also need to validate in other ways. For example, I do not want to save the comment if there is no comment or upload. Or, I do not want to save the comment if the image has been uploaded previously (comparing md5s with past upload md5s
2006 Mar 06
4
Newbie problem with adding new method to a class
Hi! If i have Image class and i''d like to add ''create_thumbnail'' method to it, which will later be called from product controller, where to put this method and how to call it? I''ve tried putting it inside image controller and image model, then call it like Image.create_thumbnail, but it didn''t work - undefined method `create_thumbnail''
2006 Jul 17
6
3 newbie questions
hey all, I have 3 tables like this: Images (id,name) Tags (id,name) ImagesTags(imageid,tagid) in my image model I do a "has_and_belongs_to_many :tags" but to make it work I need to rename ImagesTags(imageid,tagid) to Images_Tags(image_id,tag_id). My question is that given that I can''t rename the table, is there any way to make it work with the original names? Second question:
2006 Apr 24
0
ImageMagick and EXIF Data
Hi there, I''m writing a little application that parses an image file and extracts the camera settings from the file (the EXIF data) and saves all the fields to the database. The idea is that after awhile people will be able to search based on camera make, model, lens settings, etc... and all the pictures that meet those requirements will be displayed. The picture is stored on the file
2006 Jan 11
0
Limit attributes written out by to_yaml
I want to write out a series of records to a text file so that I can quickly edit them and then upload then again into the database. To do this I am using YAML and some code that looks like this: item = Item.find 153 File.open( ''item.yaml'', ''w'' ) do |out| YAML.dump( item, out ) end This dumps out all the field names and values which are stored in the
2007 Mar 02
0
12 commits - libswfdec/Makefile.am libswfdec/swfdec_audio_flv.c libswfdec/swfdec_flv_decoder.c libswfdec/swfdec_js.c libswfdec/swfdec_js.h libswfdec/swfdec_js_video.c libswfdec/swfdec_loader.c libswfdec/swfdec_loader_internal.h
libswfdec/Makefile.am | 1 libswfdec/swfdec_audio_flv.c | 4 - libswfdec/swfdec_flv_decoder.c | 60 ++++++++++++++++--- libswfdec/swfdec_js.c | 1 libswfdec/swfdec_js.h | 1 libswfdec/swfdec_js_video.c | 114 +++++++++++++++++++++++++++++++++++++ libswfdec/swfdec_loader.c | 21 ++++++
2007 Apr 06
0
3 commits - libswfdec-gtk/swfdec_gtk_loader.c libswfdec/Makefile.am libswfdec/swfdec_codec.c libswfdec/swfdec_codec_ffmpeg.c libswfdec/swfdec_codec_gst.c libswfdec/swfdec_codec.h libswfdec/swfdec_codec_screen.c libswfdec/swfdec_codec_video.c
libswfdec-gtk/swfdec_gtk_loader.c | 10 -- libswfdec/Makefile.am | 2 libswfdec/swfdec_codec.c | 39 -------- libswfdec/swfdec_codec.h | 26 ----- libswfdec/swfdec_codec_ffmpeg.c | 98 ++++++++------------- libswfdec/swfdec_codec_gst.c | 174 +++++++++++++++++++------------------- libswfdec/swfdec_codec_screen.c | 60 +++++--------
2005 Jan 09
19
Shorewall and CUPS printing interference
I''m having a problem with the Shorewall firewall and CUPS printing interfering with each other. My Linux firewall machine is acting as both a CUPS server and client for all of my tests. Shorewall 2.0.13 CUPS 1.1.22-2 Linux kernel 2.6.9 CUPS was working fine to print to my Epson C84 (network connected via a Netgear PS101 print server using lpd://PS101.IP.address/raw ) until I
2006 Mar 23
0
Reading image file field data directly into RMagick
I''m trying to read image data from an upload file field directly into an RMagick image object without having to temporally save the image file first. Assuming my file field param is assigned to @temp_file, i tried RMagicks from_blob method: img = Magick::Image::from_blob(@temp_file.read) But i get an error message saying that the blob is empty. I also tried feeding it the entire
2006 May 30
1
Can''t read from file field second time around
This piece of code takes an uploaded image and resizes it. It''s a bit nasty at the moment as I am still messing around with it. What I can''t understand is why it works for one iteration but then fails with: zero-length blob not permitted `'' On the line: img = Magick::Image.from_blob(self.image).first I am basically doing this in the controller and it fails on the
2007 Apr 19
2
invalid geometry string in change_geometry
I get the following error at the browser: ArgumentError in ImagesController#upload invalid geometry string `110×'' ... for the call to change_geometry with an explicit size (''110x'') as the geometry string: def make_thumb (the_img) require ''RMagick'' size = "110x" debugger if ENV[''RAILS_ENV''] ==
2006 May 10
0
Saving extracted data
Hi there, I have a file upload form on my page that is for images. In the model I have this: def file_data=(file_data) @file_data = file_data write_attribute ''extension'', file_data.original_filename.split(''.'').last.downcase write_attribute("content_type", file_data.content_type) write_attribute("current_name",
2006 May 17
0
send_data not working properly with link_remote_to
I''m reading an image in an link_to_remote call,and then using send_data i send the read image as :type => "image/png" :disposition => "inline"...but when the div tag gets updated i see only ascii characters .....but if i do the same operation using normal call(link_to) i see it functioning normal ....could someone explain . my view: <%=
2007 Oct 18
0
18 commits - doc/swfdec-sections.txt libswfdec/Makefile.am libswfdec/swfdec_as_interpret.c libswfdec/swfdec_as_strings.c libswfdec/swfdec_button_movie.c libswfdec/swfdec_event.c libswfdec/swfdec_event.h libswfdec/swfdec_flash_security.c
doc/swfdec-sections.txt | 1 libswfdec/Makefile.am | 4 libswfdec/swfdec_as_interpret.c | 24 +- libswfdec/swfdec_as_strings.c | 1 libswfdec/swfdec_button_movie.c | 3 libswfdec/swfdec_event.c | 5 libswfdec/swfdec_event.h | 2 libswfdec/swfdec_flash_security.c | 95 ++++++----
2008 Dec 04
2
Does animated gif will work properly using RMagick?
Dear all, I have used RMagic to read and write a image while uploading. An animated gif was read from my local machine and was written in my images folder using RMagick. But the animated gif which i read was witten in my folder without animation. What should i do to write the gif image with animation. Here is my code to read and write image while uploading. image = params[:image][:blob]
2010 Oct 01
20
Paperclip not executing FFMPEG properly
Im using a customs processor to run ffmpeg on a video to create a thumbnail. So far so good. Except when I do: cmd = "-i #{@file.path} -f flv -s 320x240 ~/Downloads/foobar/q.flv" success = Paperclip.run(''ffmpeg'', cmd) Console is reporting: ffmpeg ''-i /var/folders/uL/uL0bYOOZEZaJH5E+BmDJVE+++TI/-Tmp-/stream, 16824,1.mpeg -f flv -s 320x240