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

The Rails Drop - A Ruby on Rails blog

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: = 

In Partial write

  Rank: = person_counter + 1
  Name: = 


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

View original post


How to use Workling in Rails to increase the speed of the request processing

Renu's Blog

In ruby on rails application, if your request is taking too much time to process, you can make some part of the code to run in background.

For example,

In my application , I am sending notifications to owner,watch listers and trackers of a post, if there is any activity on the post. So when someone comments on the post, people will be getting notifications. I am using delayed jobs to generate notifications. But the problem here is inserts into delayed jobs. Whenever I comment on a post, all the inserts into the delayed job table takes long time, hence the response is coming too late.

My CommentsController

class CommentsController < ApplicationController

  def comment
   @comment =[:comment])

To make the inserts into delayed jobs in the background, I used Workling. Implementing Workling is very simple.

1. Install the Workling plugin

script/plugin install git://

2. Create the…

View original post 55 more words