I have this class:
class Logo < ActiveRecord::Base
has_one :something
has_attachment :content_type => :image,
:storage => :db_file,
:max_size => 500.kilobytes
:thumbnails => {:web => '150x100', :pdf =>
‘150x100’},
:processor => ‘MiniMagick’
validates_as_attachment
end
OK, logos are working great in the application, resizing, storage,
retrieval, …, fine. But the validation of existing logos fails with
(complete trace below)
Logo.find(:first).valid?
NameError: undefined local variable or method `full_filename’ for
#Logo:0x3561ed8
And unfortunately that is triggered by something’s
validates_associated if no logo is uploaded in its edition. I don’t
see why valid? ends up calling set_size_from_temp_path, sizes were
correctly computed and stored on creation:
pp Logo.find(:first)
#<Logo:0x35593f0
@attributes=
{“content_type”=>“image/jpeg”,
“size”=>“187697”,
“thumbnail”=>nil,
“id”=>“1”,
“height”=>“768”,
“db_file_id”=>“3”,
“filename”=>“img_1651.jpeg”,
“parent_id”=>nil,
“width”=>“1024”}>
This happens with all logos in the application, isn’t that
suspicious? I’ve not diffed svn with the installed version but both
CHANGELOGs start with
- April 2, 2007 *
– fxn
Logo.find(:first).valid?
NameError: undefined local variable or method full_filename' for #<Logo:0x3561ed8> from ./script/../config/../config/../vendor/rails/ activerecord/lib/active_record/base.rb:1860:in
method_missing’
from ./script/…/config/…/config/…/vendor/plugins/
attachment_fu/lib/technoweenie/attachment_fu.rb:276:in temp_paths' from ./script/../config/../config/../vendor/plugins/ attachment_fu/lib/technoweenie/attachment_fu.rb:270:in
temp_path’
from ./script/…/config/…/config/…/vendor/plugins/
attachment_fu/lib/technoweenie/attachment_fu.rb:236:in
save_attachment?' from ./script/../config/../config/../vendor/plugins/ attachment_fu/lib/technoweenie/attachment_fu.rb:339:in
set_size_from_temp_path’
from ./script/…/config/…/config/…/vendor/rails/
activerecord/lib/active_record/callbacks.rb:333:in send' from ./script/../config/../config/../vendor/rails/ activerecord/lib/active_record/callbacks.rb:333:in
callback’
from ./script/…/config/…/config/…/vendor/rails/
activerecord/lib/active_record/callbacks.rb:330:in each' from ./script/../config/../config/../vendor/rails/ activerecord/lib/active_record/callbacks.rb:330:in
callback’
from ./script/…/config/…/config/…/vendor/rails/
activerecord/lib/active_record/callbacks.rb:295:in `valid?’
from (irb):16