# Nil.symbolize\_keys -- error with attachment\_fu

**URL:** <https://www.ruby-forum.com/t/nil-symbolize-keys-error-with-attachment-fu/92327>\
**Category:** Rails\
**Created:** [April 18, 2007, 9:14am UTC](https://www.ruby-forum.com/t/nil-symbolize-keys-error-with-attachment-fu/92327 "2007-04-18T09:14:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [April 18, 2007, 9:14am UTC](https://www.ruby-forum.com/t/nil-symbolize-keys-error-with-attachment-fu/92327/1 "2007-04-18T09:14:42Z")

</div>

I’ve spent at least 2 hours on this one problem. On my local machine  
in my controller I have this:

def new  
@page\_title = “New User”  
@user = User.new  
@photo = Photo.new  
end

All is good.  
Now, on the remote server I get an error when accessing the ‘new’  
view. If I remove @photo = Photo.new from the controller then the  
error goes away. This same error is also happening on the create  
method, even though it is the exact same code on my local machine.  
Here is the error:

NoMethodError in UsersController#new

You have a nil object when you didn’t expect it!  
The error occurred while evaluating nil.symbolize\_keys

#{RAILS\_ROOT}/vendor/plugins/attachment\_fu/lib/technoweenie/  
attachment\_fu/backends/s3\_backend.rb:136:in `included' #{RAILS_ROOT}/vendor/plugins/attachment_fu/lib/technoweenie/ attachment_fu.rb:79:in`include’  
#{RAILS\_ROOT}/vendor/plugins/attachment\_fu/lib/technoweenie/  
attachment\_fu.rb:79:in `has_attachment' #{RAILS_ROOT}/app/models/photo.rb:9 #{RAILS_ROOT}/app/controllers/users_controller.rb:96:in`new’

---

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [April 18, 2007, 6:29pm UTC](https://www.ruby-forum.com/t/nil-symbolize-keys-error-with-attachment-fu/92327/2 "2007-04-18T18:29:36Z")

</div>

I thought maybe the server cannot find my amazon\_s3.yml file so I  
added this attachment\_fu option to the model:

:storage =\> :s3, :s3\_config\_path =\> (RAILS\_ROOT + ‘/config/  
amazon\_s3.yml’),

But, same error ☹

---

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [June 16, 2008, 11:09pm UTC](https://www.ruby-forum.com/t/nil-symbolize-keys-error-with-attachment-fu/92327/3 "2008-06-16T23:09:00Z")

</div>

Did you solve this problem? I get this error when switching to  
production and not in development.

jko170 wrote:

> I thought maybe the server cannot find my amazon\_s3.yml file so I  
> added this attachment\_fu option to the model:
> 
> :storage =\> :s3, :s3\_config\_path =\> (RAILS\_ROOT + ‘/config/  
> amazon\_s3.yml’),
> 
> But, same error ☹

---

<div class="post-metadata">

**Author:** ![jko170](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d07c76/32.png) [@jko170](https://www.ruby-forum.com/u/jko170)\
**Post date:** [April 23, 2009, 7:33pm UTC](https://www.ruby-forum.com/t/nil-symbolize-keys-error-with-attachment-fu/92327/4 "2009-04-23T19:33:21Z")

</div>

Make sure you have credentials in your amazon\_s3.yml file setup for that  
environment – production: …

Navin Samuel wrote:

> Did you solve this problem? I get this error when switching to  
> production and not in development.
> 
> jko170 wrote:
> 
> > I thought maybe the server cannot find my amazon\_s3.yml file so I  
> > added this attachment\_fu option to the model:
> > 
> > :storage =\> :s3, :s3\_config\_path =\> (RAILS\_ROOT + ‘/config/  
> > amazon\_s3.yml’),
> > 
> > But, same error ☹
