0

I have this code snippet in my view:

%table
      %tr
        - images.each do |photo|
          %td
            .image
              = cl_image_tag(photo.path, size: BOTTLE_IMAGE_SIZE_FOR_AA_MANAGE_UPLOAD_PAGE)
              - if images.count > 1
                = radio_button_tag 'upload', photo.id, photo.is_primary, class: 'manage_uploads'

Currently if I have more than 15 images, all of them are shown on the same row. I want that if I have more than 15 images, it should display it on the new line i.e new "tr". I am unable to figure out a clean and simple way to achieve this.

1 Answer 1

3

Try this

images.each_slice(15) do |photo|
%tr
  %td
...

Check what each_slice gives you to get the result you want.

Cheers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.