Cody A. Ray

Fixing the "unknown attribute: uploaded_file" error in the ShareBox Tutorial

March 12, 2012

While going through the (quite good) ShareBox Tutorial that teaches you to build a Dropbox-like sharing app, I stumbled on a nasty bug. The tutorial wisely uses the paperclip gem for file attachments, but after moving from local hosting to Amazon’s S3, I started getting an exception in the AssetsController create action.

  ActiveRecord::UnknownAttributeError in AssetsController#create<br />
  unknown attribute: uploaded_file<br />
  app/controllers/assets_controller:17:in `create'

At the time, Googling the error didn’t help (gasp!), so here are all the pieces together to help any wary travelers who may stumble here looking for the same answer. Turns out, the error doesn’t indicate the real problem at all. Fortunately, however, the fix is simple.

  1. In the asset model file, asset.rb, change the path to :s3_credentials from using RAILS_ROOT to Rails.root.

  2. In the Gemfile, replace 'aws-s3' with 'awk-sdk'. Don’t forget to bundle install

That’s all!

Credits go to

1 comment

Imported from the previous site.

[...] – A Dropbox-like Sharing App using Ruby on Rails A week ago, I posted a quick fix to a bug in the Sharebox tutorial. The next day, it appears that the site hosting this tutorial [...]
© 2009–2026 Cody A. Ray
RSSGitHubLinkedIn