Issues with using attachment_fu plugin

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 . I have downloaded this plugin from 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 :-

    undefined method `starts_with' for "public/post_images":String

Application_Trace gives me the following errors:-

    /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'     vendor/plugins/will_paginate/lib/will_paginate/finder.rb:170:in `method_missing'     app/models/post_image.rb:9     app/controllers/groups_controller.rb:290:in `post_message'

error while trying to upload a picture.

My post_image.rb looks like this:-

    class PostImage < ActiveRecord::Base       belongs_to :group_post

      has_attachment :content_type => :image, :resize_to => [50,50],                      :storage => :file_system, :partition => 'false',#:path_prefix => 'public/images/topic_images',                      :max_size => 100.kilobytes,     # :resize_to => '200x200>',                      :thumbnails => { :thumb => '50x50>' },                      :processor => 'ImageScience'

    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):-

    def post_message         @group_post = GroupPost.new(params[:group_post])         @group_comment = GroupComment.new(params[:group_comment])

        @investor_group = InvestorGroup.find(params[:id])         @group_post.investor_group_id = @investor_group.id         investor_id = session['investor_id']         @group_post.post_by = investor_id

        if @group_post.save           flash[:notice] = 'Post was successfully created.'         else           flash[:notice] = 'Post was not successfully created.'         end

        respond_to do |format|           format.html {redirect_to :action => "show", :id => params[:id]}           format.js         end

    @post_image = PostImage.new(params[:post_image]) #LINE 290         if @post_image.save            flash[:notice] = "Picture is successfully uploaded"            #redirect_to :action => :index         else           flash[:notice] = "Picture is not successfully uploaded"           #render :action => :new         end     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 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.

    <%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| -%>         <p><label>Start Discussion:</label><%=f.text_field :message%></p>         <%=f.file_field :uploaded_data%>         <%=submit_tag "Post"%></p>       <%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...