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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a71dc316af524b943bef7a6af497e90077d4c636
4
- data.tar.gz: 44411f7fcf26f7784227866a2eefd07c63911fef
3
+ metadata.gz: caaabe3db1ec5878ce71d8ddf19ed4bfdae1692d
4
+ data.tar.gz: c1166ae6028950930fd21e57303b6ad0fa7289c1
5
5
  SHA512:
6
- metadata.gz: 418d3a188bb3b6cdc36eb1d918ae3fdc4fc6493c27fbf2dd12785f188c9fd5f83e6f09ea0b7723f44cfd7802905a5f911ec55b9e743bf951a51cb74231f074a2
7
- data.tar.gz: 5d6e5763c209d8d4eda6de700930e12afa3e544cd282cc664d5e05c57c2f5e487501b739bc9261bcf00881fd2e5eb5c8409a9ff079f4f8665f3b56c55be893a7
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
- raise InvalidDeltaColumn.new("#{self.to_s} model doesn't have attribute with name '#{attribute}.")
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?
@@ -1,3 +1,3 @@
1
1
  module DeltaAttributes
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
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.2
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-08-30 00:00:00.000000000 Z
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.3
81
+ rubygems_version: 2.0.6
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: delta attributes