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