act_as_cached 0.0.3 → 0.0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  <tt>ActAsCached</tt> provides a lightweight second level cache.
10
10
 
11
- ## Supports
11
+ ## Supports
12
12
 
13
13
  * ActiveRecord associations
14
14
  * ActtiveRecord::FinderMethods (primary key only)
@@ -56,6 +56,7 @@ Topic.find(:first).comments.find(1).user
56
56
  Topic.find(:first)
57
57
  => #<Topic id: 1 ,title: 'foo'>
58
58
  Comment.find(1)
59
+ # Comment Load (0.4ms) SELECT `comments`.* FROM `comments` WHERE `comments`.`id` = 1 LIMIT 1
59
60
  => #<Comment id: 1, content: "xxxx">
60
61
  Comment.find(1).user
61
62
  => #<User id: 1, name: 'foo'>
@@ -102,7 +103,8 @@ end
102
103
 
103
104
  ## Tips
104
105
 
105
- * Currently not support <tt>ActiveRecord::Relation#find</tt> , If you wrote the `default_scope` in your class, cache won't be enable.
106
+ * Currently not support <tt>ActiveRecord::Relation#find</tt> , If you wrote the `default_scope` in your class, cache won't be enabled.
107
+ * Be aware of [skipping-callbacks](http://edgeguides.rubyonrails.org/active_record_callbacks.html#skipping-callbacks) while using it.
106
108
 
107
109
  ----------------------
108
110
 
data/lib/act_as_cached.rb CHANGED
@@ -1,5 +1,6 @@
1
- require 'act_as_cached/configurable'
2
1
  require 'active_support/dependencies/autoload'
2
+ require 'active_support/core_ext/module/attribute_accessors'
3
+ require 'act_as_cached/configurable'
3
4
  module ActAsCached
4
5
  extend Configurable
5
6
 
@@ -8,9 +9,5 @@ module ActAsCached
8
9
  autoload :Mixin
9
10
  autoload :Helpers
10
11
  autoload :ActiveRecord
11
-
12
- module ActiveRecord
13
- autoload :Actobserver
14
- end
15
12
  end
16
13
  require 'act_as_cached/rails' if defined?(::Rails::Engine)
@@ -1,6 +1,7 @@
1
1
  module ActAsCached
2
2
  module ActiveRecord
3
3
  extend ActiveSupport::Autoload
4
+ autoload :Actobserver
4
5
  autoload :Association
5
6
  autoload :CollectionAssociation
6
7
  autoload :HasManyThroughAssociation
@@ -8,7 +8,7 @@ module ActAsCached
8
8
  end
9
9
 
10
10
  def cache_path
11
- [cache_mod.name,owner.to_param,reflection.class_name].join('/')
11
+ [cache_mod.name,owner.to_param,reflection.name,reflection.class_name].join('/')
12
12
  end
13
13
  end
14
14
  end
@@ -1,3 +1,4 @@
1
+ require 'active_support/core_ext/module/delegation'
1
2
  module ActAsCached
2
3
  module Mixin
3
4
  def self.included(klass)
@@ -1,3 +1,3 @@
1
1
  module ActAsCached
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: act_as_cached
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-26 00:00:00.000000000 Z
12
+ date: 2013-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport