# Acts\_as\_attachment failing tests, thumbnailing

**URL:** <https://www.ruby-forum.com/t/acts-as-attachment-failing-tests-thumbnailing/67003>\
**Category:** Rails\
**Created:** [August 30, 2006, 8:57pm UTC](https://www.ruby-forum.com/t/acts-as-attachment-failing-tests-thumbnailing/67003 "2006-08-30T20:57:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [August 30, 2006, 8:57pm UTC](https://www.ruby-forum.com/t/acts-as-attachment-failing-tests-thumbnailing/67003/1 "2006-08-30T20:57:58Z")

</div>

Hi all,

I’m having trouble getting acts\_as\_attachment going. It’s installed  
and configured as per the documentation:

[http://weblog.techno-weenie.net/articles/acts\_as\_attachment](http://weblog.techno-weenie.net/articles/acts_as_attachment)

However, it’s throwing the error that:

undefined method `find\_or\_initialize\_by\_thumbnail\_and\_parent\_id’ for  
BranchLogo:Class

when trying to create an object.

It’s also failing a large number of tests when I try and run the unit  
tests:

47 tests, 152 assertions, 0 failures, 12 errors

(All to do with thumbnailing)

Have I got something misconfigured? Or have I grabbed a broken  
version? Or is this a known problem?

Thanks a lot!

Tom

---

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [August 31, 2006, 12:06am UTC](https://www.ruby-forum.com/t/acts-as-attachment-failing-tests-thumbnailing/67003/2 "2006-08-31T00:06:23Z")

</div>

Tom T. wrote:

> Hi all,
> 
> I’m having trouble getting acts\_as\_attachment going. It’s installed  
> and configured as per the documentation:

With thanks from Rick, I’ve managed to get this going. Turned out the  
latest version needs edge rails, and I was running 1.1.6.

This version works correctly:

[http://svn.techno-weenie.net/projects/plugins/tags/acts\_as\_attachment-1.1.6/](http://svn.techno-weenie.net/projects/plugins/tags/acts_as_attachment-1.1.6/)

Cheers,

Tom

---

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [September 8, 2006, 12:24pm UTC](https://www.ruby-forum.com/t/acts-as-attachment-failing-tests-thumbnailing/67003/3 "2006-09-08T12:24:00Z")

</div>

Tom T. wrote:

> Tom T. wrote:
> 
> > Hi all,
> > 
> > I’m having trouble getting acts\_as\_attachment going. It’s installed  
> > and configured as per the documentation:
> 
> With thanks from Rick, I’ve managed to get this going. Turned out the  
> latest version needs edge rails, and I was running 1.1.6.
> 
> This version works correctly:
> 
> [http://svn.techno-weenie.net/projects/plugins/tags/acts\_as\_attachment-1.1.6/](http://svn.techno-weenie.net/projects/plugins/tags/acts_as_attachment-1.1.6/)
> 
> Cheers,
> 
> Tom

Hi,

Im having the same trouble with thumbnails.

Im running rails 1.1.6 and also installed this acts\_as\_attachment  
version  
[http://svn.techno-weenie.net/projects/plugins/tags/acts\_as\_attachment-1.1.6/](http://svn.techno-weenie.net/projects/plugins/tags/acts_as_attachment-1.1.6/)

---

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [September 21, 2006, 12:21pm UTC](https://www.ruby-forum.com/t/acts-as-attachment-failing-tests-thumbnailing/67003/4 "2006-09-21T12:21:14Z")

</div>

nevermind, im working to hard and have gone deaf dumb and blind.

Is it bad if there is a floating grey thing in my vision ?

---

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [September 21, 2006, 12:18pm UTC](https://www.ruby-forum.com/t/acts-as-attachment-failing-tests-thumbnailing/67003/5 "2006-09-21T12:18:22Z")

</div>

I have the smae problem. I need to get the following version:

[http://svn.techno-weenie.net/projects/plugins/tags/acts\_as\_attachment-1.1.6/](http://svn.techno-weenie.net/projects/plugins/tags/acts_as_attachment-1.1.6/)

I havent used svn before, but asume i have to install that to get this  
plugin. Well appart from that i can screen scrape the file contents.

Suggestions on easiest way to download would be appreciated.

Yeah yeah nubie question =)

---

<div class="post-metadata">

**Author:** ![tomtt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e47c2d/32.png) [@tomtt](https://www.ruby-forum.com/u/tomtt)\
**Post date:** [August 21, 2007, 11:17pm UTC](https://www.ruby-forum.com/t/acts-as-attachment-failing-tests-thumbnailing/67003/6 "2007-08-21T23:17:36Z")

</div>

Adam wrote:

> nevermind, im working to hard and have gone deaf dumb and blind.
> 
> Is it bad if there is a floating grey thing in my vision ?

I know it is very late, but for ppl who still use Rails 1.1.6, here is  
the solution for this problem

> **[acts\_as\_attachment error : undefined method...](http://bloggershetty.blogspot.com/2007/08/actsasattachment-error-undefined-method.html)**
>
> You will possibly be seeing this error when you use acts\_as\_attachment for thumbnailing. undefined method \`find\_or\_initialize\_by\_thumbnail\_...

basically replace find\_or\_initialize\_thumbnail in insance\_methods.rb  
method with this

def find\_or\_initialize\_thumbnail(file\_name\_suffix)  
respond\_to?(:parent\_id) ?  
thumbnail\_class.find\_by\_thumbnail\_and\_parent\_id  
(file\_name\_suffix.to\_s, id) ||  
thumbnail\_class.new(:thumbnail=\>file\_name\_suffix.to\_s,  
:parent\_id=\>id) :  
thumbnail\_class.new(:thumbnail=\>file\_name\_suffix.to\_s)  
end
