# Attachment\_fu calling strip on FileIO

**URL:** <https://www.ruby-forum.com/t/attachment-fu-calling-strip-on-fileio/127126>\
**Category:** Rails\
**Created:** [January 25, 2008, 6:23am UTC](https://www.ruby-forum.com/t/attachment-fu-calling-strip-on-fileio/127126 "2008-01-25T06:23:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisolsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c6cbf5/32.png) [@chrisolsen](https://www.ruby-forum.com/u/chrisolsen)\
**Post date:** [January 25, 2008, 6:23am UTC](https://www.ruby-forum.com/t/attachment-fu-calling-strip-on-fileio/127126/1 "2008-01-25T06:23:42Z")

</div>

At least I seem to be doing something that is making it call the strip  
method.

NoMethodError in AccountsController#create  
undefined method `strip’ for  
#ActionController::UploadedStringIO:0x23df0c0

# photo model

class Photo \< ActiveRecord::Base  
belongs\_to :photo\_for, :polymorphic =\> true

has\_attachment :content\_type =\> :image,  
:storage =\> :file\_system,  
:max\_size =\> 5.megabytes  
end

# account controller

class AccountsController \< ApplicationController

def create  
@account = Account.new(params[:account])  
@account.build\_photo(params[:photo]) unless  
params[:photo][“filename”].blank?  
@user = @account.users.build(params[:user])  
if @account.save  
…  
end  
end  
end

I can’t see anything that is wrong here, at least according to the  
examples this should work. I thought it could be because of the  
polymorphic association, but from the call stack it doesn’t seem that  
that would be the issue.

vendor/plugins/attachment\_fu/lib/technoweenie/attachment\_fu.rb:332:in  
`sanitize_filename' vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb:48:in`filename=’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/base.rb:2117:in  
`send' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2117:in`attributes=’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/base.rb:2116:in  
`each' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:2116:in`attributes=’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/base.rb:1926:in  
`initialize' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/has_one_association.rb:18:in`new’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/associations/has\_one\_association.rb:18:in  
`build' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/has_one_association.rb:83:in`new\_record’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/base.rb:1693:in  
`with_scope' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/has_one_association.rb:83:in`send’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/associations/has\_one\_association.rb:83:in  
`new_record' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/has_one_association.rb:18:in`build’  
/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active\_record/associations.rb:1114:in  
`send' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations.rb:1114:in`build\_photo’  
app/controllers/accounts\_controller.rb:8:in `create’

Thanks for any help

Here
