delta_attributes 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/delta_attributes3_2/main.rb +5 -0
- data/lib/delta_attributes4/main.rb +2 -1
- data/lib/shared/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caaabe3db1ec5878ce71d8ddf19ed4bfdae1692d
|
4
|
+
data.tar.gz: c1166ae6028950930fd21e57303b6ad0fa7289c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa00e97cb462eee6c9de17deb768ae2832586d042316009ef0fac8b048a7aa8ac8001b74181ad63ed39c54ce68441dbc60b6d58749a986b55149a7e6f414fe8a
|
7
|
+
data.tar.gz: a772dbe34f9ec9a5ee2e0c17b9ac37583870eb1996066a29f092791c1a1999893a7f0034381485609a67cac7adf7a3512d383b8a50119348f9db03caa7fe9df6
|
data/README.md
CHANGED
@@ -19,6 +19,10 @@
|
|
19
19
|
This solves problem with simultaneous updating of same field by different threads
|
20
20
|
without locking record (problem known as race condition http://en.wikipedia.org/wiki/Race_condition).
|
21
21
|
|
22
|
+
What it means for you is that you do NOT need to LOCK users table record when updating money field
|
23
|
+
from different threads if you "mark" money field as delta attribute. Sometimes this improves application
|
24
|
+
speed significantly as other threads don't wait till current thread finishes it's work.
|
25
|
+
|
22
26
|
## Installation
|
23
27
|
|
24
28
|
Add this line to your application's Gemfile:
|
@@ -52,6 +52,11 @@ module ActiveRecord
|
|
52
52
|
return @_delta_attributes if args.empty?
|
53
53
|
|
54
54
|
args.each do |attribute|
|
55
|
+
if self.columns_hash[attribute.to_s].blank?
|
56
|
+
logger.warn("#{self.to_s} model doesn't have attribute with name '#{attribute}' or you have pending migrations.")
|
57
|
+
next
|
58
|
+
end
|
59
|
+
|
55
60
|
if self.columns_hash[attribute.to_s] && !self.columns_hash[attribute.to_s].number?
|
56
61
|
raise InvalidDeltaColumn.new("Delta attributes only work with number attributes, column `#{attribute}` is not a number.")
|
57
62
|
end
|
@@ -22,7 +22,8 @@ module ActiveRecord
|
|
22
22
|
args.each do |attribute|
|
23
23
|
|
24
24
|
if self.columns_hash[attribute.to_s].blank?
|
25
|
-
|
25
|
+
logger.warn("#{self.to_s} model doesn't have attribute with name #{attribute} or you have pending migrations.")
|
26
|
+
next
|
26
27
|
end
|
27
28
|
|
28
29
|
if self.columns_hash[attribute.to_s] && !self.columns_hash[attribute.to_s].number?
|
data/lib/shared/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delta_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleh Novosad, Yuriy Lavryk, Arya
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.0.
|
81
|
+
rubygems_version: 2.0.6
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: delta attributes
|