# Controlling Data in Liquid texts

**URL:** <https://www.ruby-forum.com/t/controlling-data-in-liquid-texts/137526>\
**Category:** Rails\
**Created:** [May 13, 2008, 11:36pm UTC](https://www.ruby-forum.com/t/controlling-data-in-liquid-texts/137526 "2008-05-13T23:36:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will\_Merrell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/4491bb/32.png) [@Will\_Merrell](https://www.ruby-forum.com/u/Will_Merrell)\
**Post date:** [May 13, 2008, 11:36pm UTC](https://www.ruby-forum.com/t/controlling-data-in-liquid-texts/137526/1 "2008-05-13T23:36:29Z")

</div>

Ok, I am baffled by this and need some help. Bear with me this is fairly  
deep and technical.

I have some user editable content on several of my pages in my rails  
app. I have implemented this using the Liquid plugin. The basic  
functionality works fine. One of the things a user can add is a liquid  
command that will produce a randomly selected quote (or testimonial)  
from one of our past customers.

The problem that has me baffled is that if the user adds more than one  
of these quotes on the same page, we frequently get duplicates of the  
same quote. We want to eliminate this and ensure that we don’t get  
duplicates on the same page.

I have tried several ways to do this. The basic algorithm that I want to  
use is to keep a list of the quotes that have been generated and only  
generate a quote that has not been seen before. The place where I get  
stuck, is that I have been unable to figure out how to create a variable  
to store this list in. Any variable that is visible inside the liquid  
code has to be way too global. These solutions work in development mode,  
but they crash in production mode. Any variable that can be local to a  
single page generation cycle is not visible inside the liquid code.

Has anybody ever done anything like this? Does anyone have enough  
experience with liquid to have any ideas about how to deal with this?

I am happy to post some code, but right now its a lot of code to wade  
through. I don’t want to take up airspace unless someone thinks they can  
help me.

Thanks,

– Will Merrell

> **[Home | swet](https://www.swet.org/)**
