Why do I get an "undefined method for `has_attached_file` when installing PaperClip? Why do I get an "undefined method for `has_attached_file` when installing PaperClip? ruby ruby

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


I'd suggest installing paperclip gem. Then you'd just need to add config.gem 'paperclip' to your environment.rb and run sudo rake gems:install.


create the file paperclip.rb inside the config/initializers/paperclip.rb

Add the below lines and restart the server

require "paperclip/railtie"

Paperclip::Railtie.insert