Uh, I’m kind of trying to follow the Mike C. tutorial on
attachment_fu but uh, seems it is incomplete…
I get this error on submitting the form with upload
undefined method `upload_data=’
What’s that?
Where do I define that? I’m guessing in the model file, but what do I
define it as?!
Also, in the model file,
has_attachment options list
:processor => Rmagick
doesn’t work, as a symbol or with quotes around Rmagick.
What is the expected syntax here?
Thanks for any help.
(yes I’ve kind of given up on my own uploads for now… but not
forever, I’ll break out of plugins quick as I can)
I get this error on submitting the form with upload
undefined method `upload_data=’
What’s that?
Where do I define that? I’m guessing in the model file, but what do I
define it as?!
uploaded_data is the attachment_fu method that deals with the uploaded
file. You shouldn’t have to define it - you just need to have your
model configured correctly
Also, in the model file,
has_attachment options list
:processor => Rmagick
doesn’t work, as a symbol or with quotes around Rmagick.
What is the expected syntax here?
You do need quotes around Rmagick. What is your actual model code -
options and list look like placeholders. My suspicion is that your
has_attachment configuration line has a syntax error and so
attachment_fu is not getting invoked to deal with the file.
Thanks for any help.
(yes I’ve kind of given up on my own uploads for now… but not
forever, I’ll break out of plugins quick as I can)
–
Cynthia K.
[email protected]
class Mugshot < ActiveRecord::Base
has_attachment :content_type => :image,
:storage => :file_system,
:max_size => 500.kilobytes,
:resize_to => ‘300x300>’,
:thumbnails => { :thumb => ‘100x100>’ }
validates_as_attachment
end
—this should be fine! I only have ImageMagick and RMagick installed,
none of the others. With or without the :processor => ‘Rmagick’
Still error!
my schema:
ActiveRecord::Schema.define(:version => 1) do
create_table “mugshots”, :force => true do |t|
t.column “parent_id”, :integer
t.column “content_type”, :string
t.column “filename”, :string
t.column “thumbnail”, :string
t.column “size”, :integer
t.column “width”, :integer
t.column “height”, :integer
end
end
–My controller:
class MugshotController < ApplicationController
def new
@mugshot = Mugshot.new
end
def create
@mugshot = Mugshot.new(params[:mugshot])
if @mugshot.save
flash[:notice] = "Mugshot was successfully created."
redirect_to mugshot_url(@mugshot)
else
render :action => 'new'
end
end
end
I don’t get it. The Mike C. tutorial gets all these raves from lots
of people. It’s ok, missing some details perhaps, but doesn’t seem to
work for me.
Does anybody have any code samples of working attachment_fu ?
Any other tutorials than the Mike C. page?
On 26 Jul 2007, at 13:09, [email protected] wrote:
class Mugshot < ActiveRecord::Base
[snip]
my schema:
[snip]
–My controller:
[snip]
That code all looks good. How about your view code? I notice that
the subject of this thread mentions “upload_data=” when the actual
method is “uploaded_data=”.
Regards,
Andy S.