1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge remote-tracking branch 'docrails/master'

This commit is contained in:
Xavier Noria 2013-02-02 10:33:19 +01:00
commit 08b60fc2e5
3 changed files with 5 additions and 5 deletions

View file

@ -99,14 +99,14 @@ end
This method generates a cache key that depends on all products and can be used in the view: This method generates a cache key that depends on all products and can be used in the view:
```ruby ```erb
<% cache(cache_key_for_products) do %> <% cache(cache_key_for_products) do %>
All available products: All available products:
<% end %> <% end %>
``` ```
You can also use an Active Record model as the cache key: You can also use an Active Record model as the cache key:
```ruby ```erb
<% Product.all.each do |p| %> <% Product.all.each do |p| %>
<% cache(p) do %> <% cache(p) do %>
<%= link_to p.name, product_url(p) %> <%= link_to p.name, product_url(p) %>
@ -118,7 +118,7 @@ Behind the scenes, a method called `cache_key` will be invoked on the model and
You can also combine the two schemes which is called "Russian Doll Caching": You can also combine the two schemes which is called "Russian Doll Caching":
```ruby ```erb
<% cache(cache_key_for_products) do %> <% cache(cache_key_for_products) do %>
All available products: All available products:
<% Product.all.each do |p| %> <% Product.all.each do |p| %>

View file

@ -310,7 +310,7 @@ In Rails 3.0 and above, generators don't just look in the source root for templa
```erb ```erb
module <%= class_name %>Helper module <%= class_name %>Helper
attr_reader :<%= plural_name %>, <%= plural_name.singularize %> attr_reader :<%= plural_name %>, :<%= plural_name.singularize %>
end end
``` ```

View file

@ -86,7 +86,7 @@ Run `rake` to run the test. This test should fail because we haven't implemented
Great - now you are ready to start development. Great - now you are ready to start development.
Then in `lib/yaffle.rb` require `lib/core_ext`: Then in `lib/yaffle.rb` add `require "yaffle/core_ext"`:
```ruby ```ruby
# yaffle/lib/yaffle.rb # yaffle/lib/yaffle.rb