7

Paperclip produces this error, after checking out the plugin's rails3 branch. My Gemfile has following line:

gem 'paperclip', :git => 'http://github.com/thoughtbot/paperclip.git', :branch => 'rails3'

And the error message is:

NoMethodError: undefined method `has_attached_file' for #<Class:0x2a50530>
mirza
  • 952
  • 1
  • 9
  • 11

5 Answers5

15

Update 06-21-10: the thoughtbot version has been fixed.

I had to add Paperclip::Railtie.insert to my application.rb at the end of class Application < Rails::Application to get it to work correctly. I have deleted my fork since the official repo is working. Hope that helps someone.

You will also need to add the following to your Gemfile

gem "paperclip", :git => "http://github.com/thoughtbot/paperclip.git"
Sam Soffes
  • 14,831
  • 9
  • 76
  • 80
3

I have a paperclip fork, you can try if it will work at your end, just change your Gemfile:

gem 'paperclip', :git => 'git://github.com/lmumar/paperclip.git', :branch => 'rails3'

Don't forget to run bundle install after updating your Gemfile.

Hope it will fix your problems.

lmumar

Ondrej Janacek
  • 12,486
  • 14
  • 59
  • 93
lmumar
  • 113
  • 6
  • "There was a LoadError while evaluating paperclip.gemspec. Does it try to require a relative path? That doesn't work in Ruby 1.9." – mirza May 20 '10 at 08:32
  • Thanks - working for me :-) This will keep me going until the master gets fixed fully for Rails3. – firecall May 22 '10 at 06:50
  • This fork worked for me as well. Hopefully thoughtbot will pull from lmumar soon :) – Sam Soffes May 25 '10 at 02:34
1

That didn't work for me. I have done below things and it is working perfectly:

  • Add "Paperclip::Railtie.insert" in application.rb
  • Add "config.gem 'paperclip'" in development.rb
Surupa Ray
  • 11
  • 2
1

minter's fork worked for me:

gem 'paperclip', :git => 'http://github.com/minter/paperclip.git', :branch => 'rails3'
mirza
  • 952
  • 1
  • 9
  • 11
-1

it works with Jason King's paperclip version:

gem 'paperclip', :git => 'http://github.com/JasonKing/paperclip.git', :branch => 'rails3'
mirza
  • 952
  • 1
  • 9
  • 11