howdy!
I had the problem that attachment_fu didn''t make a thumbnail, but
everything else worked. I read this post
http://www.ruby-forum.com/topic/104213 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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
> undefined method `find_or_initialize_by_thumbnail_and_parent_id'' forThe plugin is written for rails 1.2. I have an old tagged acts_as_attachment plugin for 1.1.6: http://svn.techno-weenie.net/projects/plugins/tags/acts_as_attachment-1.1.6/ -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thanks, but i''m using rails 1.2.2 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 > http://www.ruby-forum.com/topic/104213 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 > endMy 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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.