I'm using a render partial: 'fragment', locals:{obj:item} for every row in table.
It takes long time to process the whole page.
Is there a way to save all fragments for each item at first loading and don't render them again each time during the server works?
UPDATED
card/index.html.haml
%table
=render partial: 'card/card', collection: @cards, cached: true
card/_card.html.haml
-cache card do
%tr=card.title
card_controller.rb
def index
@cards = Card.order(:name)
end
SOLVED
Cached started to work after I add to development.rb:
config.action_controller.perform_caching = true
config.cache_store = :memory_store, { size: 64.megabytes }
Or you can run rails dev:cache to toggle caching.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With