simply_versioned + attachment_fu + aws/s3


After adding simply_versioned support in a model that is using attachment_fu with S3 storage, I was getting this strange error the second time my versions association was used in my application:

NoMethodError (undefined method `quoted_table_name' for "0.5.1":String)

After a few hours, I finally figured out that this was caused by the aws/s3 setting its Version to “0.5.1” (in a module).  That module gets included by attachment_fu.  The simply_versioned plugin uses a Version model.  So I don’t know it this a bug with attachment_fu or Rails, but here’s what I did to fix the problem.

  1. Rename the Version model to DataVersion
  2. add “set_table_name ‘versions'” in the DataVersion model if you don’t want to rename the table in the database
  3. In the simply_versioned.rb file, search for the “has_many” instruction and add :class_name => ‘DataVersion’

And voilà.  Everything should work fine now.

3 thoughts on “simply_versioned + attachment_fu + aws/s3

  1. Not really, I have attachment_fu configured to use Amazon S3 storage in my model. If you use “filesystem” storage (the default in attachment_fu), I guess you shouldn’t run into problems with simply_versioned.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s