2009/6/15 Frederick Cheung <[email protected]>: > > > > On Jun 15, 9:05 am, nico Itkin <[email protected]> > wrote: >> Frederick Cheung wrote: > >> Thanks Fred for your help, >> >> I guess you're right, do you know a nice way to force constant_cache to >> be run before each test ? >> >> Otherwise I think i'll try to prevent rake to prepare db before running >> tests, but i'm not sure this is an optimal solution to my pb. >
I had a very similar problem recently and solved it by changing my constants to class variables of the appropriate models, then in the accessor function for each variable, tested for nil and read from db if necessary. In fact if nil I read the whole set of variables for that model. I have decided that using class variables is actually nicer as it locates the 'constants' with the appropriate model. Colin --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

