HTTP semantics, because such request would not be sending a complete representation of the invoice for replacement. Example: Invoice paid = 1 How do you set that flag in a RESTFULL way? RFC 5789
bought <%= o.product.name %> <% end %> <% cache “recent_products” do %> All available products: <% Product.all.each do |p| %> <%= link_to p.name, product_url(p) %> <% end %> <% end %>
bought <%= o.product.name %> <% end %> <% cache “recent_products” do %> All available products: <% Product.all.each do |p| %> <%= link_to p.name, product_url(p) %> <% end %> <% end %>
end def after_destroy(product) expire_cache(product) end def expire_cache(product) expire_fragment 'recent_products‘ end end Controller cache_sweeper :product_sweeper, :only => [:create, :update, :destroy]
my todo lists:</p> <%= render project.todolists %> <% end %> todolists/_todolist.html.erb <% cache todolist %> <p> <%= todolist.name %>:</p> <%= render todolist.todos %> <% end %> Todos/_todo.html.erb <% cache todo do %> <p><%= todo.name %></p> <% end %> Project Todolist Todo class Project < ActiveRedord::Base end class Todolist< ActiveRedord::Base belongs_to :project end class Todo< ActiveRedord::Base belongs_to :todolist end
my todo lists:</p> <%= render project.todolists %> <% end %> todolists/_todolist.html.erb <% cache todolist %> <p> <%= todolist.name %>:</p> <%= render todolist.todos %> <% end %> Todos/_todo.html.erb <% cache todo do %> <p><%= todo.name %></p> <% end %> Project Todolist Todo class Project < ActiveRedord::Base end class Todolist< ActiveRedord::Base belongs_to :project, touch: true end class Todo< ActiveRedord::Base belongs_to :todolist, touch: true end
work in Rails 4.0 and included as gem dependencies, but will be removed in the jump to Rails 4.1. This means that the upgrade to Rails 4.1 may be more painful than the upgrade to Rails 4.0.