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.
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
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"
Undefined method has_attached_file for my ActiveRecord model
I am not sure what happened. I ended up doing a db roll back and re-migrated the migration yet again. Then I exited all my terminals running in the background and restarted everything. It is working as of now.
Paperclip/docsplit has_attached_file not reconized
You made a mistake. Read the documentation carefully.
You can move your code from controller to model(!).
Paperclip has_attached_file not working with Rails establish_connection
You need to install paperclip gem in the existing project, copy and configure AWS S3 information from the project which you need to access.
In Gemfile
# paperclip gem for image manipulation
gem 'paperclip', :git=> 'https://github.com/thoughtbot/paperclip', :ref => '523bd46c768226893f23889079a7aa9c73b57d68'
# aws sdk for uploading at AWS
gem 'aws-sdk', '< 2.0'
gem 's3'
In production.rb
# configuration for amazon s3
config.paperclip_defaults = {
:storage => :s3,
:s3_region=> ENV['AWS_REGION'],
:s3_credentials => {
:bucket => ENV['AWS_BUCKET'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
}
Related Topics
Undefined Method Error When Creating Delayed_Job Workers with Script/Delay_Job
Import CSV in Batches of Lines in Rails
How to Mix Required Argument and Optional Arguments in Ruby
Idiomatically Mock Openuri.Open_Uri with Minitest
Map Array of Ints to Nested Array Access
Ruby on Rails - £ Sign Troubles
How to Update a Model's Attribute with a Virtual Attribute
Copy One Slide from Google Slides into a New Presentation Using API
How to Fill Out Login Form with Mechanize in Ruby
Why Do Numeric String Comparisons Give Unexpected Results
Ruby Multiple Background Threads
Ruby Open-Uri Can't Open Url (M1 MAC)
Why Does My Recursive Method from Helper Not Return Every Value
Why Can't I Change the Value of Self
Gem Install Therubyracer -V 0.11.4 Fails on Os X 10.10
How to Convert This Ruby String into an Array
Differencebetween a Constant and a Variable in Ruby
Ruby Syntax Question: Rational(A, B) and Rational.New!(A, B)