Discussions

Ask a Question
Back to All

Access secont element in contents array

It is possible to access contents.posts.first and .last. How do I access arbitrary elements? I know I can do .all[i], but this fetches all documents from the database and is thus inefficient. In locomotivecms_steam-1.1.1/lib/locomotive/steam/liquid/drops/content_entry_collection.rb a slice(index, length) function is defined which should do exactly what I want. However it is protected and cannot be accessed over the liquid API. What do?