technoweenie/attachment_fu

attachement_fu and rails 3.0

ippa opened this issue · 4 comments

ippa commented

When I use my old proven attachement_fu setup from rails 2.x projects in a new rails 3.0 project I run into a problem with this line:

@image = @owner.images.create!(:uploaded_data => @DaTa)

The error is "unknown attribute: uploaded_data"

ippa commented

Scrap the above, was due to a brainmeltdown. Now I seem to have run into something real though:

NoMethodError (undefined method `callback' for #Image:0x7fb12eef2f40):

This error seems to trigger right after the whole image has been uploaded.
Smells active record 3.0 ...

It looks like ActiveRecord::Callbacks has changed a bunch in Rails 3. The callback method that attachment_fu is trying to call was a private method and looks like it was removed with the following commit:

http://github.com/rails/rails/commit/4f37b97033f596ec2c95eb53e9964e051c224981#L10L360

I don't actually use the after_attachment_saved callback in my app, so I just commented out the following line in vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:

callback :after_attachment_saved

tfl commented

you are right, dmann. Commenting this out "solves" the problem but raises a bigger one: an uploaded image will stay as it is - no further processing will happen. So... no thumbnail generation will take place. Disable callbacks makes attachment_fu almost useless.

It's a great pity because AF seems not be actively maintained anymore.

Take a look at :
http://github.com/woahdae/attachment_fu - rails3 branch

I installed it with :
./script/rails plugin install http://github.com/woahdae/attachment_fu.git -r rails3

So far (less than an hour in) it's working as I expect. I've even pulled in a few extensions that I've used for other projects and they're working too.