Erwin
2012-Feb-26 18:09 UTC
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
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
