attachment_fu thumbnails

schaf88 wrote in post #236924:

howdy! I had the problem that attachment_fu didn't make a thumbnail, but everything else worked. I read this post Attachment_fu thumbnail not created - Rails - Ruby-Forum and added a parent_id column. now I get the following error when I trie to add a photo:

undefined method `find_or_initialize_by_thumbnail_and_parent_id' for Photo:Class

my code is:

class Photo < ActiveRecord::Base   has_attachment :content_type => :image,                  :storage => :file_system,            :max_size => 1.megabyte,                  :thumbnails => { :thumb => '164x164>' } end

create_table :photos do |t|   t.column :filename, :string   t.column :posted_on, :datetime   t.column :description, :text   t.column :name, :string end

def create   @photo = Photo.new(params[:photo])   if @photo.save     redirect_to :action => 'list'   else     render :action => 'new'   end end

My first guess, You don't have 'thumbnail' column in your database table. The clue is in the error message: 'find_or_initialize_by_thumbnail_and_parent_id', means attachment_fu looks for both 'thumbnail' and 'parent_id' column

My db table looks something like this and it works fine. create_table :photos do |t|       t.string :filename, :null => false       t.string :content_type       t.string :thumbnail       t.integer :size       t.integer :width       t.integer :height       t.integer :parent_id       t.integer :album_id