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
– Will Merrell