Hello. Please, help me to DRY this code snippet. The task is to print div
content, but to print it in div, when i%17 ==0 and make it without div,
when not. I guess that it maybe proc or lambda will help, but I never used
it before. Or maybe it is some simpler method?
#splitter
- @servers.each_with_index do |server, i|
* - if i % 17 == 0*
* = content_tag :div, class: "pane-content" do*
*= link_to "#", class: "list-group-item server", :"data-id" =>
server.id, :"data-name" => server.name, :"data-address" => server.address
do*
* %strong= server.name*
* =", "*
* = server.address*
* - else*
* = link_to "#", class: "list-group-item server", :"data-id" =>
server.id, :"data-name" => server.name, :"data-address" => server.address
do*
* %strong= server.name*
* =", "*
* = server.address*
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/514b32c0-0d18-4d9d-961d-6c94b08524c1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.