Skip to content

Commit 700c80e

Browse files
pivotalpivotal
pivotal
authored and
pivotal
committed
fixes
1 parent d628503 commit 700c80e

File tree

3 files changed

+55
-56
lines changed

3 files changed

+55
-56
lines changed

cache-money.gemspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = "cache-money"
3-
s.version = "0.2.3"
3+
s.version = "0.2.4"
44
s.date = "2008-11-24"
55
s.summary = "Write-through and Read-through Cacheing for ActiveRecord"
66
s.email = "nick@twitter.com"
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
2828
"lib/cash/transactional.rb",
2929
"lib/cash/util/array.rb",
3030
"lib/cash/write_through.rb",
31-
"lib/cash.rb"
31+
"lib/cache_money.rb"
3232
]
3333
s.test_files = [
3434
"config/environment.rb",

lib/cache-money.rb

-53
This file was deleted.

lib/cache_money.rb

+53-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,53 @@
1-
require 'cache-money'
1+
$LOAD_PATH.unshift(File.dirname(__FILE__))
2+
3+
require 'rubygems'
4+
require 'activesupport'
5+
require 'activerecord'
6+
7+
require 'cash/lock'
8+
require 'cash/transactional'
9+
require 'cash/write_through'
10+
require 'cash/finders'
11+
require 'cash/buffered'
12+
require 'cash/index'
13+
require 'cash/config'
14+
require 'cash/accessor'
15+
16+
require 'cash/request'
17+
require 'cash/mock'
18+
require 'cash/local'
19+
20+
require 'cash/query/abstract'
21+
require 'cash/query/select'
22+
require 'cash/query/primary_key'
23+
require 'cash/query/calculation'
24+
25+
require 'cash/util/array'
26+
27+
class ActiveRecord::Base
28+
def self.is_cached(options = {})
29+
include Cash
30+
Config.create(self, options)
31+
end
32+
end
33+
34+
module Cash
35+
def self.included(active_record_class)
36+
active_record_class.class_eval do
37+
include Config, Accessor, WriteThrough, Finders
38+
extend ClassMethods
39+
end
40+
end
41+
42+
module ClassMethods
43+
def self.extended(active_record_class)
44+
class << active_record_class
45+
alias_method_chain :transaction, :cache_transaction
46+
end
47+
end
48+
49+
def transaction_with_cache_transaction(&block)
50+
repository.transaction { transaction_without_cache_transaction(&block) }
51+
end
52+
end
53+
end

0 commit comments

Comments
 (0)