Details about paperclip error: ‘Paperclip::AdapterRegistry::NoHandlerError’ when you use paperclip gem in Rails

When I was working with rails and paperclip I got this error.

Paperclip::AdapterRegistry::NoHandlerError
 = form_tag my_path, :method => :post do
  -------
  = file_field_tag "attachment" 
  -----
 

I submitted a form and it was not saving. There I found that the form sending a file too. I missed

:multipart => true 

option in the ‘form_tag’ when submitting the form. The form really not sening a file and paperclip not getting an attachment. So it throws this error.

 = form_tag my_path, :method => :post, :multipart => true do
  -------
  = file_field_tag "attachment" 
  -----
Advertisements

How to find index of records rendered by a partial with collection in Rails

Using render partial with collection how to find the index of the records?

Somewhere I found that someone is commented like,
“It seems this is an undocumented feature of rails.”

Anyway we can find this by using ‘recordName_counter’.

Render a partial with collection


= render :partial = > "person", :collection => @winners
Name: = person.name 

In Partial write


  Rank: = person_counter + 1
  Name: = person.name 

Result


Rank: 1 Name: Peter
Rank: 2 Name: Paul
Rank: 3 Name: Mary

Details about Rails paperclip error: ‘There was an error processing the thumbnail for paperclip-reprocess’

I got this error while working with paperclip. The project was stable and I have no idea why this error happens at this point of time.

[paperclip] An error was received while processing: #
[paperclip] An error was received while processing: #<Paperclip::PaperclipError: There was an error processing the thumbnail for paperclip-reprocess20110822-2281-19969sz

So I was lazy to fix the error, and find that I have no imagemagick installed in my new system. After installing ‘imagemagick’ it got fixed.

$ sudo apt-get update
$ sudo apt-get install imagemagick --fix-missing