yaphi wrote: > Is there a better way to show admin link than this? I want to > implement page caching but can't due to it not having conditions. > Fragment caching seems wrong for my site since every page should be > cached except I have this toolbar div shown in the layout if the user > is logged in. >
So cache all your fragments... one fragment is the toolbar div, the other fragment is the rest of the page (effectively your 'page' caching). I cache a left-nav fragment (effectively the admin versus not admin menu), the main area fragment (for show or index, edit/new not cached), and a right-nav fragment (a context menu of related models based on what currently appears in the main area. the context-nav is itself a fragment cache of multi-tiered fragments - the retrieval of all the related models of a given model can be very expensive, so for a given model instance, each type of related model has its own fragment). Takes a bit to get used to for devs new to the project, but its easily an order of magnitude faster to assemble fragments. Relating a new model just invalidates that "related model type" fragment and the overall "related models" fragment. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

