Forum: Ruby on Rails rescue ActiveRecord::RecordInvalid

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Petan C. (Guest)
on 2009-01-30 11:38
Hi all,

I am using is_attachment plugin, but I will always end up with this

RuntimeError in PostsController#create

which was caused by:

version.filename = file_name_for_version(version_name)
   rescue ActiveRecord::RecordInvalid
  raise "BLAH"

RecordInvalid was raised by save! because is invalid.
Does anyone know why? I am uploading an image so it should validate

Any help would be most welcome
Thomas r. K. (Guest)
on 2009-01-30 11:43
(Received via mailing list)
Hi Petan,

That's clearly not enough code to help you. What are the validations
on you version model?

Besides that it's good practice to not user save! but only save.

ciao, tom

On Jan 30, 10:38 am, Petan C. <removed_email_address@domain.invalid>
Petan C. (Guest)
on 2009-01-30 11:52
Hi Tom,

thx for your super quick reply.

is_attachment :image_engine => :rmagick, :image_versions => {  :small =>
{ :cropper => [230,230] }}, :validate => {:min_width => 230, :min_height
=> 230, :content_type => :image }

This topic is locked and can not be replied to.