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" 
  -----

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

Install Rails 3.2 using rvm on redhat

Upgrade Packages

yum update

Installing Recommended Packages

yum install gcc-c++ patch readline readline-devel zlib zlib-devel 
yum install libyaml-devel libffi-devel openssl-devel make 
yum install bzip2 autoconf automake libtool bison iconv-devel

Install RVM ( Ruby Version Manager )

$ curl -L get.rvm.io | bash -s stable

Install Required Ruby Version

$ rvm install 1.9.3

Install rails

$ gem install rails --version '3.2.19'

Install Rails 3.2 with Ruby 1.9.3 using rvm in Ubuntu 14.0.1

Check ruby is already installed in your system or not

$ ruby -v 

Install curl if not installed

$ sudo apt-get install curl

Check curl version by

$ curl --version

Install RVM

Execute the command in the terminal

$ curl -L https://get.rvm.io | bash -s stable

If the installation is done, close the terminal window and open it again to load the rvm into the shell

Check rvm version

$ rvm -v

rvm 1.25.30 (stable) by Wayne E. Seguin , Michal Papis  [https://rvm.io/]

List rvm known rubies

$ rvm list known

Use rvm to install ruby 1.9.3

$ rvm install 1.9.3

Check the ruby versions available

$ rvm list rubies

Check the ruby version by

$ ruby -v

If this again shows the message to install ruby, then set this ruby version as default

$ rvm use ruby-1.9.3-p547 --default

then check ruby -v

Make gem package up to date

$ gem update

Install Rails 3.2.19

$ gem install rails --version '3.2.19'

Check rails version

$ rails -v 

You are ready to go!