Uploading files: wrong number of arguments (1 for 0)

I am trying to upload a file (pretty simple stuff right?), but keep
getting the argument error.

I have cross referenced what I have to prior uses and cannot find any
errors with what I have.

/Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/has_one_association.rb:18:in
initialize' /Library/Ruby/Gems/1.8/gems/activerecord-2.0.2/lib/active_record/associations/has_one_association.rb:18:innew’
/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:innew_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:insend’
/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:inbuild’
/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:inbuild_photo’
app/controllers/accounts_controller.rb:8:in `create’--------

Here is the controller code that is causing the error:
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
  ...
else
  render :action => "new"
end

end

Here is my model file:
class Account < ActiveRecord::Base
has_many :agents
has_many :users
has_one :photo, :as => :photo_for

validates_associated :photo, :if => :has_photo?
end

If I include puts params[:photo].inspect in the controller it does show
me there is a datastream there

{“filename”=>#ActionController::UploadedStringIO:0x2519cc4}

Thanks for the help.

I don’t know what it is about posting to a forum, but a problem that has
confused the hell out of you for an hour tends to become clear after
posting here.

The issue was an initialize method that preset some variables in the
model.