Maybe the title of this post sounds crazy but its true.

  - iterate_for(@reports)
  - @reports.to_enum.with_index(1).each do |r, i|
        - r.alerts.reverse.each do |a|
          - if a.code == 14
            %tr
              %td.num_col       Trip #{i}
          - elsif a.code == 15
            %tr
              %td.num_col       Trip #{i}



 def iterate_for(reports)
    Rails.logger.info "THe value of reports is #{reports}"
    Rails.logger.info "The length of reports i #{reports.size}"
    reports.to_enum.with_index(1).each do |r,i|
      Rails.logger.info "The report is #{r}"
      Rails.logger.info "The count is #{i}"
    end
  end


I created an iterate_for method just to see what happens when I log
the output in a helper to the console. And the with_index method
correctly sets the value of i to 1 and so forth. But within the haml,
this:

Trip #{i}

i is equal to the value 20 every time.

Im not sure what's going on.

thanks for response


-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to