I’m coding the site http://Meer.li, a site where users can upload designs.
In my design model, I need to find designs that have the same title and group them. How do I make such a query?
Right now I just have:
@designs = Design.order_by( :created_at, :desc )
I’m running rails 3.2, ruby 1.9.3 and I’m using mongoid for the database.
Further Explanation:
Sorry if I weren’t specific enough. I have a lot of designs and some of these designs have the same title. First of all I want to find all the designs that have the same title. Second of all I want to group those designs within an array, so I don’t need several arrays to get my designs. Last thing, is that the designs with the same title, should only be grouped if they’re made by the same user
If i got your question right this should do the trick:
UPDATE:
so maybe this works
never tried this with mongo db – maybe it works or it helps you to adapt it for your needs
hope this helps!