rails/rails — pull request #5032 by carlosantoniodasilva (2012-02-14 02:20:41+00:00)
Title: Allow collection helpers with block to access current object in the collection

This gives a lot more flexibility to the user, for instance to generate a collection of check boxes and labels, allowing to add custom classes or data-* attributes to the label/check_box using another object attribute.

This basically mimics options_for_select functionality that accepts a third option for each item to generate html attributes for each option.

Example usage:

```ruby
f.collection_check_boxes :font_ids, Font.all, :id, :name do |b|
b.check_box + b.label(:class => b.object.class_name)
end
```

This is one request that appears from time to time in SimpleForm issues/mailing, like [this one](https://github.com/plataformatec/simple_form/issues/452).