petan
1
Hi all,
I am using is_attachment plugin, but I will always end up with this
error:
RuntimeError in PostsController#create
BLAH
which was caused by:
version.filename = file_name_for_version(version_name)
begin
version.save!
rescue ActiveRecord::RecordInvalid
raise “BLAH”
end
end
RecordInvalid was raised by save! because is invalid.
Does anyone know why? I am uploading an image so it should validate
fine.
Any help would be most welcome
petan
2
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. [email protected]
petan
3
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 }
Cheers,
P.