We have a similar problem, and the two options we saw were: 1) cron job that ran either rails or sql command to prune the table 2) a function that runs when something else happens (like login/logout)
We ended up choosing 2, just because it was easier to implement (didn't have to play around with cron jobs etc). Cheers Simon On Fri, 14 Aug 2009 18:46:41 +0800, RVince <rvinc...@hotmail.com> wrote: > > I have a table that retains strings to display in a select box. The > select box is supposed to display only the most recently added 10 > Strings (there is a field, tstamp, which holds the timestamp of the > most recent change to a row). > > So there's never a reason for the table to hold more than 10 strings. > The issue -- my question -- is how do I keep only the most recent 10 > records in the db, efficiently? This issue must be faced by many, and > many times over. Rather than try to reinvent the wheel here, can > anyone tell me how this sort of thing is typically handled? Thanks, > RVince > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---