# Issues with using attachment\_fu plugin

**URL:** <https://discuss.rubyonrails.org/t/issues-with-using-attachment-fu-plugin/58962>\
**Category:** rubyonrails-talk\
**Created:** [May 14, 2011, 8:09am UTC](https://discuss.rubyonrails.org/t/issues-with-using-attachment-fu-plugin/58962 "2011-05-14T08:09:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![11155](https://avatars.discourse-cdn.com/v4/letter/1/d26b3c/32.png) [@11155](https://discuss.rubyonrails.org/u/11155)\
**Post date:** [May 14, 2011, 8:09am UTC](https://discuss.rubyonrails.org/t/issues-with-using-attachment-fu-plugin/58962/1 "2011-05-14T08:09:18Z")

</div>

Hello all,

I am trying to use attachment\_fu plugin in my Rails app to implement a feature wherein I can post a message along with an appropriate image it.

I am using Rails 2.0.2 and Ruby 1.8.7 for project specific purposes. I am using Ubuntu 10.04 OS.

The tutorial that I am to integrate this plugin is following is:- [http://clarkware.com/blog/2007/02/24/file-upload-fu#FileUploadFu](http://clarkware.com/blog/2007/02/24/file-upload-fu#FileUploadFu) . I have downloaded this plugin from [https://github.com/technoweenie/attachment\_fu](https://github.com/technoweenie/attachment_fu) . I use the notes from this page on how to best use this plugin.

I have installed the image science gem - `image_science (1.2.1)`. I have also installed the freeimage packages that come with Ubuntu via the Synaptic Package Mangager i.e. the following packages have been installed:- `libfreeimage3, libfreeimage3-dev, libfreeimage3-dbg`.

I am getting an :-

&nbsp;&nbsp;&nbsp;&nbsp;undefined method `starts\_with' for "public/post\_images":String

Application\_Trace gives me the following errors:-

&nbsp;&nbsp;&nbsp;&nbsp;/home/mohnish/.rvm/gems/ruby-1.8.7-p334/gems/activerecord-2.0.2/lib/active\_record/base.rb:1532:in `method_missing_without_paginate' &nbsp;&nbsp;&nbsp;&nbsp;vendor/plugins/will_paginate/lib/will_paginate/finder.rb:170:in `method\_missing' &nbsp;&nbsp;&nbsp;&nbsp;app/models/post\_image.rb:9 &nbsp;&nbsp;&nbsp;&nbsp;app/controllers/groups\_controller.rb:290:in `post\_message'

error while trying to upload a picture.

My post\_image.rb looks like this:-

&nbsp;&nbsp;&nbsp;&nbsp;class PostImage \< ActiveRecord::Base &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;belongs\_to :group\_post

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;has\_attachment :content\_type =\> :image, :resize\_to =\> [50,50], &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:storage =\> :file\_system, :partition =\> 'false',#:path\_prefix =\> 'public/images/topic\_images', &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:max\_size =\> 100.kilobytes, &nbsp;&nbsp;&nbsp;&nbsp;# :resize\_to =\> '200x200\>', &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:thumbnails =\> { :thumb =\> '50x50\>' }, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:processor =\> 'ImageScience'

&nbsp;&nbsp;&nbsp;&nbsp;end

In the above code line 9 of post\_image.rb corresponds to the `:processor =\> 'ImageScience'`

The part of the groups controller where I am encountering an error is at line 290(its commented in the method):-

&nbsp;&nbsp;&nbsp;&nbsp;def post\_message &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@group\_post = GroupPost.new(params[:group\_post]) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@group\_comment = GroupComment.new(params[:group\_comment])

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@investor\_group = InvestorGroup.find(params[:id]) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@group\_post.investor\_group\_id = @investor\_group.id &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;investor\_id = session['investor\_id'] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;@group\_post.post\_by = investor\_id

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if @group\_post.save &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flash[:notice] = 'Post was successfully created.' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flash[:notice] = 'Post was not successfully created.' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;respond\_to do |format| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format.html {redirect\_to :action =\> "show", :id =\> params[:id]} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format.js &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;&nbsp;@post\_image = PostImage.new(params[:post\_image]) #LINE 290 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if @post\_image.save &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flash[:notice] = "Picture is successfully uploaded" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#redirect\_to :action =\> :index &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;flash[:notice] = "Picture is not successfully uploaded" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#render :action =\> :new &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;&nbsp;&nbsp;end

I have read about issues with path\_prefix when one is making use of Ruby 1.8.7 from:- [http://groups.google.com/group/attachment\_fu/browse\_thread/thread/502dd4504a59c84d](http://groups.google.com/group/attachment_fu/browse_thread/thread/502dd4504a59c84d) and I have made the appropriate changes to attachment\_fu.rb. I have also restarted my server and tested it again for every change I make to the plugin files. I have commented my path\_prefix for now and as of now this plugin is taking the default path as to where one can store images which is `"public/{table_name}"`

I basically am making use of a form\_for tag in my views to get this working for me. I am not sure if I am making use of the form\_for correctly. Please correct me in case I am going wrong here by any chance.

&nbsp;&nbsp;&nbsp;&nbsp;\<%form\_for :group\_post, @group\_post,:post\_image,@post\_image, :url =\> {:action =\> :post\_message, :id =\> params[:id]},:html =\> {:multipart =\> 'true',:class =\> 'form'},:id =\> 'new\_post' do |f,form| -%\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<p\>\<label\>Start Discussion:\</label\>\<%=f.text\_field :message%\>\</p\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<%=f.file\_field :uploaded\_data%\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<%=submit\_tag "Post"%\>\</p\> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<%end%\>

I have around 3-4 months of experience with Rails and I am still a newbie , kindly bear with me and correct me if feasible on where I could be going wrong.

Any help or suggestions on how can I fix this would be highly appreciated.

Thank you...
