NoMethodError: undefined method has_attached_file

The paperclip generates this error after checking the rails3 plugin branch. My gemfile has the following line:

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

And the error message:

 NoMethodError: undefined method `has_attached_file' for #<Class:0x2a50530> 
+7
ruby-on-rails ruby-on-rails-3 paperclip
source share
5 answers

Update 06-21-10: fixed version of thoughtbot .

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

You also need to add the following to your Gemfile.

 gem "paperclip", :git => "http://github.com/thoughtbot/paperclip.git" 
+15
source share

I have a paper clip fork, you can try, if it works on your part, just change your Gemfile:

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

Remember to start installing the package after updating the Gemfile.

Hope this fixes your problems.

lmumar

+3
source share

minter fork worked for me:

 gem 'paperclip', :git => 'http://github.com/minter/paperclip.git', :branch => 'rails3' 
+1
source share

This did not work for me. I did something below and it works fine:

  • Add "Paperclip :: Railtie.insert" to application.rb
  • Add "config.gem 'paperclip'" to development.rb
+1
source share

he works with the Jason King paperclip version:

 gem 'paperclip', :git => 'http://github.com/JasonKing/paperclip.git', :branch => 'rails3' 
-one
source share

All Articles