On Thu, Apr 9, 2009 at 5:40 PM, Shak Shak
<[email protected]> wrote:
>
> Hi all,
>
> What is the best way to store variables strictly for the lifetime of a
> Rails' request?
>
> I'm currently storing AR records in Rails.cache. Although this saves a
> trip to the DB, I feel it's unnecessary to hit the cache more than once
> per request (even when using MemoryStore there are Marshals involved).
> Where is the best place to stash any stuff retrieved from the cache? It
> doesn't need to (in fact, shouldn't) last past a single request.
>
> An instance variable in ApplicationController sounds like it would do
> this, but I would say such data should be kept with the model. Of course
> a class variable in the model will keep its value each request (in
> production) so is inappropriate for this.
>
> Any ideas?
>
> Shak
> --

It may be useful to understand a little more of what you're trying to achieve.
If you're needing to keep something around for a request, an instance
variable in the controller may the right place because that manages
the the request.
Some more information on your specific problem will help us help you.

Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to