Skip to content


Fixing the “unknown attribute: uploaded_file” error in the ShareBox Tutorial

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
  unknown attribute: uploaded_file
  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

Posted in Tutorials.


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. Sharebox – A Dropbox-like Sharing App using Ruby on Rails – Cody A. Ray linked to this post on March 20, 2012

    […] – 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 […]



Some HTML is OK

or, reply to this post via trackback.

 



Log in here!