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


method_missing_without_paginate' vendor/plugins/will_paginate/lib/will_paginate/finder.rb:170:inmethod_missing’
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’


In the above code line 9 of post_image.rb corresponds to the :processor => 'ImageScience'

I even tried a require ‘imagescience’, a require ‘image_science’, a
require ‘Image_Science’, a require ‘ImageScience’ in my post_image.rb,
envirnoment.rb and in the irb. In all cases it failed to detect it, I
don’t know why…(I tried various options, but I don’t know which is the
correct way to get this gem detected for use in my app) . I have
installed the image_science 1.2.1 .

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 =[:group_post])
    @group_comment =[:group_comment])

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

      flash[:notice] = 'Post was successfully created.'
      flash[:notice] = 'Post was not successfully created.'

    respond_to do |format|
      format.html {redirect_to :action => "show", :id =>


@post_image =[:post_image]) #LINE 290
       flash[:notice] = "Picture is successfully uploaded"
       #redirect_to :action => :index
      flash[:notice] = "Picture is not successfully uploaded"
      #render :action => :new

I have read about issues with path_prefix when one is making use of Ruby
1.8.7 from:-
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}". An interesting thing to note from the url
mentioned in this para is that the string should start with ‘/’, but in
the case of this plugin it starts with ‘p’ from public. Is that a
conflict by any chance??

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

<%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| -%>

Start Discussion:<%=f.text_field

<%=f.file_field :uploaded_data%>
<%=submit_tag “Post”%>

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

Thank you…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs