Changed to use spoon's meethod
git-svn-id: file:///home/svn/incoming/trunk@3590 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
7b4fb0d6aa
commit
457f476b4c
|
@ -19,27 +19,23 @@ end
|
|||
|
||||
# ActiveRecord/sqlite3 has locking issues when you update a table with a pending select
|
||||
# This set of instance/class wrappers should prevent a table lock
|
||||
# Straight up gangsta shit from spoon (ripped from BION)
|
||||
module DBSave
|
||||
|
||||
module InstanceMethods
|
||||
def save(*args)
|
||||
Lock.mutex.synchronize do
|
||||
super(*args)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
def self.included(mod)
|
||||
class << mod
|
||||
def find(*args)
|
||||
Lock.mutex.synchronize do
|
||||
super(*args)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self::included(other)
|
||||
other.module_eval{ include InstanceMethods }
|
||||
other.extend ClassMethods
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue