There are a few places you could stash one. If you have some class somewhere, say, MyThinger, you could declare a little accessor like this:
class MyThinger class << self attr_accessor :things end end Then you would be able to write MyThinger.things and use it like a variable, getting and setting it to whatever stuff you'd like to keep around. The other simpler way to do it would be to just use a Global Variable. In ruby, a global variable is any variable which begins with a $. So, you could use $things, and it'd stick around. It's usually considered bad practice to use them, but if you choose a descriptive name nothing else is likely to want to use, there really is no justification for such fears. — Jenna On 28/08/2011, at 5:30 AM, Anders Schneiderman wrote: > Depending on how you deploy camping you can just stick some stuff in some > class variables if you just need them in one controller, or even global > variables if you want them in many places. Then all you'd need to do is boot > a local copy with The Camping Server and do your things. The objects will > just stay in ruby's memory because unlike cgi apps or things like PHP, ruby > web apps don't flush their global scope reload on every request. > > Wouldn't that be the ridiculously easy and straight forward way to solve this? > > Thanks, Jenna! Sounds good. > > Since I'm new to camping, can you tell me where I would add the global > objects? > > Anders > _______________________________________________ > Camping-list mailing list > Camping-list@rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list
_______________________________________________ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list