Search code examples
ruby-on-railsruby-on-rails-plugins

Suggestions for attachment plugin/gem for use with Rails 2.0.2 and Ruby 1.8.7


I am trying to attach files in my RoR app. I am using Rails 2.0.2 and Ruby 1.8.7 for project specific purposes. I am using Ubuntu 10.04 OS.

I have tried out two plugins (paperclip and attachment_fu) but I have no luck so far in getting things working with them. I am facing compatibility issues as the configuration I am using is pretty much not used these days.

See these URLs in order to better understand the issues that I am currently facing:

  1. Undefined method `has_attached_file' with paperclip 2.3.8 gem for Rails 2 using Ruby 1.8.7

  2. https://stackoverflow.com/questions/6000588/issues-with-attachment-fu-plugin-in-rails-2

Also, I am seeking suggestions for plugins or gems which I can use to attach files in my Rails app based on the above configuration.

Edit

I also would like to add I tried out paperclip 2.1.2 gem but it doesn't seem to get detected through IRB. I don't know how much of a difference this information will make, but I would like to add that I am also making use of RVM and having another ruby 1.9.2 with me.

Although paperclip gem is installed and shows up in my ruby gems list, I wonder why I get a null( '[]' ) when I do a require 'paperclip' through IRB.

mohnish@mohnish-desktop:~/UP/pocs_tried_for_use/post_with_image$ gem list

*** LOCAL GEMS ***

aasm (2.2.0, 2.1.1)
action_profiler (1.0.0)
actionmailer (2.3.5, 2.0.2)
actionpack (2.3.5, 2.0.2)
activerecord (2.3.5, 2.0.2)
activeresource (2.3.5, 2.0.2)
activesupport (3.0.0, 2.3.5, 2.0.2)
acts_as_reportable (1.1.1)
aws-s3 (0.6.2)
builder (2.1.2)
cgi_multipart_eof_fix (2.5.0)
color (1.4.1)
contacts (1.2.4)
daemons (1.1.0)
fastercsv (1.5.3)
fastthread (1.0.7)
ferret (0.11.6)
gdata (1.1.1)
gem_plugin (0.2.3)
gettext (2.1.0)
hoe (2.6.2)
hpricot (0.8.3, 0.8.2)
httpclient (2.1.5.2)
image_science (1.2.1)
json (1.4.6)
json_pure (1.4.6)
locale (2.0.5)
log4r (1.1.8)
macaddr (1.0.0)
mechanize (1.0.0)
memcache-client (1.8.5)
mime-types (1.16)
mocha (0.9.8)
mongrel (1.1.5)
mysql (2.8.1)
nokogiri (1.4.3.1)
paperclip (2.1.2)
passenger (2.2.4)
pdf-writer (1.1.8)
prawn (0.8.4)
prawn-core (0.8.4)
prawn-layout (0.8.4)
prawn-security (0.8.4)
rack (1.0.1)
railroad (0.5.0)
rails (2.0.2)
rake (0.8.7)
RedCloth (3.0.3)
rfacebook (0.9.8, 0.9.0)
rmagick (2.9.1)
ruby-activeldap (0.8.3.1)
ruby-net-ldap (0.0.4)
ruby-openid (2.1.8, 2.0.2)
rubyforge (2.0.4)
rubygems-update (1.3.7)
ruport (1.6.3)
scrubyt (0.4.06)
tinyurl (1.0.0)
transaction-simple (1.4.0)
uuid (2.3.1)
xml-simple (1.0.12)
mohnish@mohnish-desktop:~/pocs_tried_for_use/post_with_image$ ruby script/console
Loading development environment (Rails 2.0.2)
ruby-1.8.7-p334 :001 > require 'paperclip'
 => [] 
ruby-1.8.7-p334 :002 > 

Solution

  • If you're using a significantly older version of Rails you may be exposing yourself to serious security vulnerabilities, so if you can upgrade, you really should, even if it's just to another point release in the 2.0.x series.

    That being said, you could always install a version of paperclip that's from that era. Newer versions only support 2.3 or better as far as I know.

    Any project that's hosted on github will have a full version history so you can rewind the project to a particular revision that works for you. The git bisect tool is great for handling this sort of thing.