# Attachment\_fu seems to be searching the wrong location for m

**URL:** <https://www.ruby-forum.com/t/attachment-fu-seems-to-be-searching-the-wrong-location-for-m/103563>\
**Category:** Rails\
**Created:** [May 7, 2007, 10:45pm UTC](https://www.ruby-forum.com/t/attachment-fu-seems-to-be-searching-the-wrong-location-for-m/103563 "2007-05-07T22:45:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![scott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://www.ruby-forum.com/u/scott)\
**Post date:** [May 7, 2007, 10:45pm UTC](https://www.ruby-forum.com/t/attachment-fu-seems-to-be-searching-the-wrong-location-for-m/103563/1 "2007-05-07T22:45:06Z")

</div>

I just installed attachment\_fu and for some reason, it seems to be  
looking in the wrong location for my images.

I have a Product model that belongs to a photo model. the photo model  
has the attachment\_fu installed and configured like so:

class Photo \< ActiveRecord::Base  
has\_attachment :content\_type =\> :image, #Allow  
standard image formats  
:path\_prefix =\> ‘public/photos’, #Where to  
store the uploaded images (shouldn’t need this)  
:storage =\> :file\_system, #Store  
files in the filesystem  
:max\_size =\> 1.megabyte, #Maximum  
image size, 1Mb  
:thumbnails =\> {:thumb =\> ‘120x90’} #Create one  
thumbnail 120x90

validates\_as\_attachment  
end

In my Product model, I have a method to return the file path for  
simplification or a stock image if not found:

def photo\_filename  
retval = “/images/no\_image.gif”

```
unless not photo.nil? then
  retval = photo.public_filename
end
retval

```

end

For some reason, Product.photo\_filename keeps returning my $HOME  
directory:

No such file or directory - “/Users/stamosunas”

The whole trace is below… it seems to be in the attachment\_fu code  
itself where there is a problem:

/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:75:in `mkdir' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:75:in`rootdir’  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:84:in  
`directory' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:258:in`so\_name’  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:292:in  
`load_cache' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/RubyInline-3.6.3/lib/inline.rb:659:in`inline’  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
lib/ruby/gems/1.8/gems/image\_science-1.1.2/lib/image\_science.rb:84  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:32:in  
`gem_original_require' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in`require’  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/  
dependencies.rb:495:in `require' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:342:in`new\_constants\_in’  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/  
dependencies.rb:495:in `require' #{RAILS_ROOT}/vendor/plugins/attachment_fu/lib/technoweenie/ attachment_fu/processors/image_science_processor.rb:1 /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:203:in`load\_without\_new\_constant\_marking’  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/  
dependencies.rb:203:in `load_file' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:342:in`new\_constants\_in’  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/  
dependencies.rb:202:in `load_file' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:94:in`require\_or\_load’  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/  
dependencies.rb:248:in `load_missing_constant' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/ lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ dependencies.rb:452:in`const\_missing’  
#{RAILS\_ROOT}/vendor/plugins/attachment\_fu/lib/technoweenie/  
attachment\_fu.rb:85:in `const_get' #{RAILS_ROOT}/vendor/plugins/attachment_fu/lib/technoweenie/ attachment_fu.rb:85:in`has\_attachment’  
#{RAILS\_ROOT}/app/models/photo.rb:7  
#{RAILS\_ROOT}/app/models/product.rb:150:in `photo_filename' #{RAILS_ROOT}/app/views/mgs/_featured_items.rhtml:20:in`\_run\_rhtml\_47app47views47mgs47\_featured\_items46rhtml’  
#{RAILS\_ROOT}/app/views/mgs/\_featured\_items.rhtml:13:in `each' #{RAILS_ROOT}/app/views/mgs/_featured_items.rhtml:13:in`\_run\_rhtml\_47app47views47mgs47\_featured\_items46rhtml’  
#{RAILS\_ROOT}/app/views/mgs/index.rhtml:4:in  
`_run_rhtml_47app47views47mgs47index46rhtml' #{RAILS_ROOT}/app/controllers/mgs_controller.rb:14:in`call’  
#{RAILS\_ROOT}/app/controllers/mgs\_controller.rb:14  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
bin/mongrel\_rails:16:in `load’  
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/  
bin/mongrel\_rails:16

Any idea would be helpful.

Thanks!

Scott

---

<div class="post-metadata">

**Author:** ![scott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3e96dc/32.png) [@scott](https://www.ruby-forum.com/u/scott)\
**Post date:** [May 8, 2007, 3:09am UTC](https://www.ruby-forum.com/t/attachment-fu-seems-to-be-searching-the-wrong-location-for-m/103563/2 "2007-05-08T03:09:32Z")

</div>

Update:

This seems to be an issue with ImageScience. When I installed and  
switched over to ImageMagick with RMagick, I was able to upload a  
photo and have the thumbnail created correctly.

Scott
