# Attachment\_fu undefined method \`upload\_data='

**URL:** <https://www.ruby-forum.com/t/attachment-fu-undefined-method-upload-data/110421>\
**Category:** Rails\
**Created:** [July 26, 2007, 7:25am UTC](https://www.ruby-forum.com/t/attachment-fu-undefined-method-upload-data/110421 "2007-07-26T07:25:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 26, 2007, 7:25am UTC](https://www.ruby-forum.com/t/attachment-fu-undefined-method-upload-data/110421/1 "2007-07-26T07:25:55Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 26, 2007, 8:09am UTC](https://www.ruby-forum.com/t/attachment-fu-undefined-method-upload-data/110421/2 "2007-07-26T08:09:58Z")

</div>

> 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.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 26, 2007, 2:11pm UTC](https://www.ruby-forum.com/t/attachment-fu-undefined-method-upload-data/110421/3 "2007-07-26T14:11:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 27, 2007, 6:37am UTC](https://www.ruby-forum.com/t/attachment-fu-undefined-method-upload-data/110421/4 "2007-07-27T06:37:11Z")

</div>

Does anybody have any code samples of working attachment\_fu ?  
Any other tutorials than the Mike C. page?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 27, 2007, 5:51pm UTC](https://www.ruby-forum.com/t/attachment-fu-undefined-method-upload-data/110421/5 "2007-07-27T17:51:15Z")

</div>

On 26 Jul 2007, at 13:09, removed\_email\_address@domain.invalid 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.
