ruby - Rails partials and HAML -


I have an Ajax method that interprets users @collection. This code is from partial users. Now what I need to do is wrap around one of the 3l tags for every third object. I can do this with HAML? I can not just add the% ul tag to "when 1" - because that object stopped when the object was provided.

  - User-client for K + 1- Then 1% li.prost @user.login - all 2% li @ uer.login- then 3% le.lal@user.login  

This is the result I am looking for:

   

etc.

I think you want every_slice . It makes a countable partition in groups of the specified size. You can do something like this:

  - @ collection.each_slice (3) Two | Slices | % Ul% li.first = slice [0] .login% li = piece [1] .login% li.last = slice [2] .login  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -