Why do I get an undefined method for `has_attached_file` when installing PaperClip?
It is very important that you restart your server after installing new gems/plugins. This should solve your problem
Undefined method `has_attached_file' with paperclip 2.3.8 gem for Rails 2 using Ruby 1.8.7
Ok, firstly, just to cover the "obvious" base: do "ls vendor/plugins" just to make sure that some version of paperclip is actually in your plugins directory and is therefore reachable by your application.
Secondly - the "require paperclip" in the model seems wrong to me. I'm guessing that require should go in your environment instead. Try putting it at the end of config/environments.rb instead.
Thirdly (and maybe unrelated to your specific problem) - 2.0.2 is a really old version of rails. If you can I'd upgrade to 2.3.5, or at the very least, 2.2.x. For all we know - you could have a problem because you've got a new version of paperclip and an old version of rails... this does sometimes make a difference.
A lot of the other links you posted are referring to installations up to Rails3 - the solutions to their problems will be different to yours for that reason.
undefined method `has_attached_file' : Paperclip error with ActiveAdmin and cucumber
After checking all files and experiments, I finally found the solution. The problem was paperclip.rb
file in Rails.root/lib
folder. The file contains no content but it creates problem while I was running cucumber. So I deleted that file and all works. Let's hope this helps to other :-)
NoMethodError: undefined method `has_attached_file'
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"
Rails + Paperclip Error! undefined method `has_attached_file'
I solved delete the model and re create correctly...
rails g model user_icons user_id:integer url:string image:attachment
I need declare the param to file upload and used this in my paperclip model..
rookie mistake!! ;(
Related Topics
"Errno::Eaccess...Permission Denied" Running Compass Watch
Rails 5 Actioncontroller::Invalidauthenticitytoken Error
Missing a Template for This Request Format and Variant
Installing a Gem from Github with Bundler
Running Multiple Background Parallel Jobs with Rails
Get Server File Path with Paperclip
Failing to Install Nokogiri Gem
What Does the Regular Expression [\W-] Mean
Using Ruby and Net-Ssh, How to Authenticate Using the Key_Data Parameter with Net::Ssh.Start
Model Using Modules in Rails Application
Change Error Field Name in Rails
Adding a Submit Button Image to a Rails Form
Normalizing Line Endings in Ruby
Rails: How to Get a File Extension/Postfix Based on the Mime Type
Star Rating in Ajax with Ruby on Rails