table_checksum 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,11 +7,15 @@ Gem adds methods to the ActiveRecord::Base classes to easily generate checksum o
7
7
 
8
8
  This is useful for fragment caching when you list all records from table in cached partial
9
9
 
10
- <%= cache [@event, User.checksum] do %>
10
+ <% cache [@event, User.checksum] do %>
11
11
  ...
12
12
  <%= f.collection_select :user_id, @users || User.all, :id, :name %>
13
13
  ...
14
14
  <% end %>
15
+
16
+ You can also omit the `checksum` method because ActiveRecord::Base now responds to `cache_key` method
17
+
18
+ <% cache [@event, User] do %>
15
19
 
16
20
  It also uses PerRequestCache for performance.
17
21
 
@@ -13,6 +13,10 @@ module TableChecksum
13
13
  def checksum
14
14
  TableChecksum.for(self)
15
15
  end
16
+
17
+ def cache_key
18
+ checksum.to_param
19
+ end
16
20
  end
17
21
  end
18
22
 
@@ -1,7 +1,7 @@
1
1
  $:.push File.expand_path("../lib", __FILE__)
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'table_checksum'
4
- s.version = '0.0.1'
4
+ s.version = '0.0.2'
5
5
  s.summary = "Table checksum"
6
6
  s.description = "Creates checksum of tables/models using CREATE CHECKSUM sql query"
7
7
  s.authors = ["Filip Zachar"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_checksum
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: