[Ruby] Dumb ActiveRecord question

Alex Vollmer alex.vollmer at gmail.com
Fri Jan 5 14:58:28 PST 2007


OK, I switched over to "production" and lo and behold the sucker cached like
a champ! After a moment of reflection this makes sense. The edit-and-reload
abilities you love in the "development" are only possible by reloading the
entire stack. Conversely, when I edited something in "production" mode,
reloaded my browser and didn't see a change, it was the negative proof of
reloading in that configuration.

So...a big lesson learned today. Development and production environments are
quite different (something to keep in mind when perf testing).

Thanks for your responses.

--Alex V.

On 1/5/07, Frederick Alger <fred at fredalger.net> wrote:
>
> > I don't understand ActiveRecord that well, but my first thought is
> > that in development mode model classes are reloaded on every request
> > -- are you running in development mode?
>
> Correct — if you want data to persist between requests, it must be in
> the session, the flash, or the database.  Someone correct me if I'm
> wrong, but by understanding is:
>
> - Rails is not thread safe.
> - Each request is handled by reloading the environment and
> instantiating the appropriate controller to handle the request.
>
> If this is correct, it begs the question "how is this efficient?"
> How does caching the application & framework classes come into play?
>
>
> - Fred Alger
> fred.design
> fred at fredalger.net
>
> _______________________________________________
> Ruby at zenspider.com - Seattle.rb non-commercial list
> http://www.zenspider.com/seattle.rb
> http://www.zenspider.com/mailman/listinfo/ruby
>



-- 
"I think there are only three things America will be known for 2,000 years
from now when they study this civilization: the Constitution, jazz music,
and baseball."
--Gerald Early


More information about the Ruby mailing list