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.
97bd2f0974055dacf53a0643b013b32e?d=identicon&s=25 Petan Cert (petan)
on 2009-01-30 10: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
978ed7ca309d5495078702096f9add03?d=identicon&s=25 Thomas r. Koll (tomk32)
on 2009-01-30 10: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 Cert <>
97bd2f0974055dacf53a0643b013b32e?d=identicon&s=25 Petan Cert (petan)
on 2009-01-30 10: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.