mardi 29 août 2017

How to increment the loop if it does not match the id?

I'm working on a code which displays the images from the AWS server. But I'm facing trouble in looping the code.

It works fine for the 1st display but it is not going further (I've to display upto 6 images)

code for this -

def get_image_urls(user)
        user_identifications = user.user_identifications.where(current_flag: true).order(:id_dl)
        urls = []
        keys = []
        if !user_identifications.empty? && !user_identifications.nil?
            user_identifications.each_with_index do |each_id, index|
                obj = S3_BUCKET.object(each_id.aws_key)
                urls << {each_id.id_dl=> obj.presigned_url(:get)}
                keys << {each_id.id_dl=> each_id.aws_key}
            end
        end
        return urls, keys
    end

How to increment the loop based on checking the id and user.identifications value?

Aucun commentaire:

Enregistrer un commentaire