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
Rank: 1 Name: Peter
Rank: 2 Name: Paul
Rank: 3 Name: Mary
Go to the mysql console and follow these steps
> use mysql;
> update user set password=PASSWORD("mynewpassword") where User='root';
> flush privileges;
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
Suppose we have a map-icon.png file under assets/map/ folder and we need to find the path for the precompiled version of this image.
You can find the path and display it in the view by using this:
Use the following command
$ yum install redis
$ yum install redis php-pecl-redis
Start the redis service
$ service redis start
Install image magick by the following command
$ yum install ImageMagick ImageMagick-perl
The above command will install ImageMagick and its dependencies automatically.
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
$ gem install rails --version '3.2.19'