4

So this is my first question on StackOverflow.

I'm trying to implement Paperclip on Rails 3.2.3, and after clicking "submit" to create a profile with an uploaded image, I get:

Paperclip::AdapterRegistry::NoHandlerError in UsersController#update

No handler found for "Screen Shot 2012-09-01 at 11.03.43 AM.png"

My server log reads,

Paperclip::AdapterRegistry::NoHandlerError (No handler found for "Screen Shot 2012-09-01 at 11.03.43 AM.png"): app/controllers/users_controller.rb:65:in block in update' app/controllers/users_controller.rb:64:inupdate'

In my User model, I have

attr_accessible :avatar

has_attached_file :avatar, 
        :styles => { 
          :large => "500x500>", 
          :medium => "213x213>", # profile image
          :thumb => "50x50>",
          :smaller => "30x30>" }, 
          :processors => [:cropper],
         # tells paperclip how to crop the image  
        :storage => :s3,
        :s3_credentials => "#{Rails.root}/config/s3.yml", # TODO 
        :path => ":attachment/:id/:style/:basename.:extension",
        :bucket => 'eventsbucket'

The error persists whether I include the S3 info or not. In my migration I have,

class AddAvatarColumnsToUsers < ActiveRecord::Migration
  def self.up
    add_attachment :users, :avatar
  end

  def self.down
    remove_attachment :users, :avatar
  end
end

Lastly, in my Users controller update action, I have

def update
    respond_to do |format|
      if @user.update_attributes(params[:user])
        sign_in @user
        format.html { redirect_to @user, notice: 'Profile Successfully Updated' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @user.errors, status: :unprocessable_entity }
      end
   end
end

In my Gemfile I have gem "paperclip", "~> 3.1.4" (UPDATE: I've since pulled Paperclip straight from thoughtbot and problem persists). I've run bundle install. I've run db:migrate. I've read this StackOverflow entry, but the error persists whether I include "multipart => true" or not. When I tried the Emerson Lackey Tutorial, it worked up to the point where he tried to display the output of the "5.times..." command.

I'm interested in both getting Paperclip to work and understanding just what a "NoHandlerError" is and how to avoid it in the future.

Community
  • 1
  • 1
vtacreative
  • 618
  • 8
  • 22
  • 1
    What about http://stackoverflow.com/questions/10033425/paperclip-exception-paperclipadapterregistrynohandlererror – freemanoid Jan 25 '13 at 14:26
  • Looks promising, when I get some time I will check further into that just for curiosity sake. Thanks for the heads up. – vtacreative Feb 18 '13 at 04:41

1 Answers1

0

Did you try the railscasts episode # 134 ?

http://railscasts.com/episodes/134-paperclip?view=asciicast