How to get the index of the element passed to the render view?

I am displaying a collection of expenses in a form

the view in which the fom is displayed :

= simple_form_for(@project, :html => {:class => ‘form-stacked’
})
do |f|
- unless @project.expenses.count > 0
No expenses
- else
#expenses
= f.fields_for :expenses do |f|
= render “backoffice/projects/expense_fields”, :f => f
.clearfix

and the expense_fields partial is :

.row
= f.input :label, :wrapper => :nolabel, :input_html => { :class =>
“span3” }

I would like to test when the first expense item is displayed :

.row
- "if first expense… test
= f.input :label, :input_html => { :class => “span3” }

use the standard wrapper with labels

    - else
  = f.input :label, :wrapper => :nolabel, :input_html => { :class

=> “span3” } # no label wrapper

is there any way to do it ?

thanks for your feedback

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs