Attachment_fu Thumbnail class bug

CuMu.Li Comments Off

Update – This has now been fixed and included in Release 3007 Hurrah!!!!

I’ve found a bug in Rick Olsons attachment_fu plugin. If you create image attachments and using a different model for the thumbnails, eg.

class Image < ActiveRecord::Base has_many :thumbnails, :dependent => :destroy has_attachment :content_type => :image, :thumbnail_class => ‘Thumbnail’, :thumbnails => { :sidebar => “x200” }, :storage => :file_system validates_as_attachment end

class Thumbnail < ActiveRecord::Base belongs_to :image has_attachment :content_type => :image, :storage => :file_system end

If you have an image with an id of 1 and a thumbnail with an id of 1 then when you try to destroy image (id=1) the code will go into an infinite loop as the destroy_thumbnails function will think the thumbnail itself is has thumbnais and try to recursively delete itself until the stack level gets too deep.

Read more »

Testing file uploads to attachment_fu using RSpec

CuMu.Li Comments Off
I’ve been doing quite a lot of Behaviour Driven Development using RSpec recently. However, I hit a problem topday, I was trying to test file uploads to Rick Olson’s attachment_fu plugin. First I thought all I had to do was to pass it a file handle or contents of a file, not so. The tests failed moaning of missing methods. I had a rummage around in the tests for the plugin itself.
Read more »

HAML and TextMate

CuMu.Li Comments Off
HAML and TextMate

I love HAML and SASS, they’re such beautiful ways of ways of writing HTML and CSS respectively. I saw Hampton do his (I believe first) presentation at RailsConf Europe 2006 in London last year with a can of Stella and no small amount of profanity! It was a fantastic presentation and I remember commending him on a good job whilst having a cigarette outside. I started using HAML pretty much immediately after that.

However, I’ve always been a bit annoyed that TextMate doesn’t have support for it. I’ve probably just not been keeping up, but I’ve now found that in the Macromates SVN repository there is a bundle that enables HAML support in TextMate, hurrah. The URL for this bundle is http://macromates.com/svn/Bundles/trunk/Bundles/Ruby%20Haml.tmbundle

All you have to do is go to your ~/Library/Application Support/TextMate/Bundles directory and do a svn co http://macromates.com/svn/Bundles/trunk/Bundles/Ruby%20Haml.tmbundle and the support will be in TextMate. Well done Macromates and the guys at Unspace.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in