README.md in jbuilder_cache_multi-0.0.2 vs README.md in jbuilder_cache_multi-0.0.3
- old
+ new
@@ -35,10 +35,16 @@
# Or with optional key
json.cache_collection! @people, expires_in: 10.minutes, key: 'v1' do |person|
json.partial! 'person', :person => person
end
+
+ # Or with a proc as a key
+
+ json.cache_collection! @people, expires_in: 10.minutes, key: proc {|person| person.last_posted_at } do |person|
+ json.partial! 'person', :person => person
+ end
NOTE: If the items in your collection don't change frequently, it might be better to cache the entire collection like this:
(in which case you don't need this gem)
json.cache! @people do
@@ -67,9 +73,14 @@
1. Fork it ( https://github.com/joshblour/jbuilder_cache_multi/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
+
+## Testing
+ bundle install
+ appraisal install
+ appraisal rake test
## Credit
Inspired by https://github.com/n8/multi_fetch_fragments. Thank you!
And of course https://github.com/rails/jbuilder