Masatoshi Nishiguchi
Masatoshi Nishiguchi's Blog

Masatoshi Nishiguchi's Blog

Caching in rails 5

Masatoshi Nishiguchi's photo
Masatoshi Nishiguchi
·Jul 15, 2016·

1 min read

This is my note about Rails 5 caching.

Enabling/disabling caching in development environment

Use the following commands:

$ rails dev:cache
Development mode is now being cached.
$ rails dev:cache
Development mode is no longer being cached.

Fragment Caching

<% @products.each do |product| %>
  <% cache product do %>
    <%= render product %>
  <% end %>
<% end %>
<%= render partial: 'products/product', collection: @products, cached: true %>

Resources

 
Share this