Forum: Ruby on Rails Action/Fragment Cache for a Ruby and Rails Newbie

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ad04ef6af3d648d14418b85f3bf67a9a?d=identicon&s=25 eric.c (Guest)
on 2007-05-04 10:53
(Received via mailing list)
Folks,

I am working on a small rails project which has a few actions but with
intensive db and rendering.
I looked at caching models and because of scalability and
authentication needs I will have to use action cache or fragment
cache.

My problem/question is the following: I use a default layout for all
my actions (which cannot be cached) and for source code clarity I put
most of the activerecord db queries and objects processing in the
controller. Doing fragment cache works great but then it stills
execute the action code which is useless because there is no rendering
anymore using it thanks to fragment cache. The solution would be to
use action cache, but then my default layout is cached which is not
what I want as it shows up personal information (and adding a new
parameter in the route for the user is not an alternative).

Something wrong in my understanding?
Can you give me a hand on this?
Is my controller/view organisation correct?
Any good story about that?

My main concern at that level is to speed up the average connection/s
per server.

Thank you very much in advance for your help,
Cheers,
Eric.
Ba3a00606eb530dcab2c4a6a59bf366d?d=identicon&s=25 Alain Ravet (Guest)
on 2007-05-06 16:33
(Received via mailing list)
Eric,

  > for source code clarity I put most of the activerecord db queries
  > and  objects processing in the controller.
  > Doing fragment cache works  great but then it stills execute the
  > action code which is useless because there is no rendering

If you apply the
    "Skinny Controller, Fat Model"
    http://weblog.jamisbuck.org/2006/10/18/skinny-cont...
pattern, you can move those costly operations to the view where there
can be cached by fragment and page caching.


Alain
-----
blog.ravet.com
This topic is locked and can not be replied to.