calculated_attributes 0.0.20 → 0.0.21

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: 7da323e196847b4f15e503b0d19ac25d9ecb784a
4
- data.tar.gz: 807ad2214677049d809d2d72df5187ceffc1c6e3
3
+ metadata.gz: 21a523e5d620f5382b3af08ded6fff13f5e94ade
4
+ data.tar.gz: d70290a340d2e4f41cf4d84b5127d7a2142e9530
5
5
  SHA512:
6
- metadata.gz: e730af38ee04e9bd4b68d268406d4d119e23b4d81a177a5e9ab01a425e74fbc3116a8d476e19e0dbcba03a1344abfeb65838a2962ef1c81482395fab934faadf
7
- data.tar.gz: 7ee138eb56996b3d602c49ac7dcaabc6619974eea11d6166cb48c9f567f71c3311fa7938bf90df9f5718cc090af06241b4ae11a9439607d87ce490a61db3d202
6
+ metadata.gz: 9046121ecb68b88f866bf4a0ac14241a4ab56bb84d6d446d2f6b983cb7be600932d69ac3b33964651d3bfc0a019fe1a9bccd51f46fb6c3219b682bf8f68f3fec
7
+ data.tar.gz: dc58094ebf3bcba65020b595102696b8c495efaa2a6226d7fafa9cc7ea563c3d6cd9fb13221e557bd0a7c6d44956d0fbac1ad561cc6d9688ca843f8cacf5bbe0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- calculated_attributes (0.0.19)
4
+ calculated_attributes (0.0.21)
5
5
  activerecord (>= 3.2.20)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- calculated_attributes (0.0.19)
4
+ calculated_attributes (0.0.21)
5
5
  activerecord (>= 3.2.20)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- calculated_attributes (0.0.19)
4
+ calculated_attributes (0.0.21)
5
5
  activerecord (>= 3.2.20)
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  module CalculatedAttributes
2
- VERSION = '0.0.20'
2
+ VERSION = '0.0.21'
3
3
  end
@@ -193,12 +193,16 @@ module ActiveRecord
193
193
  # Updates the attribute identified by <tt>attr_name</tt> with the specified +value+. Empty strings
194
194
  # for fixnum and float columns are turned into +nil+.
195
195
  def write_attribute(attr_name, value)
196
- attr_name = attr_name.to_s
197
- attr_name = self.class.primary_key if attr_name == 'id' && self.class.primary_key
198
- @attributes_cache.delete(attr_name)
199
- column = column_for_attribute(attr_name)
196
+ if ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR == 2
197
+ write_attribute_with_type_cast(attr_name, value, true)
198
+ else
199
+ attr_name = attr_name.to_s
200
+ attr_name = self.class.primary_key if attr_name == 'id' && self.class.primary_key
201
+ @attributes_cache.delete(attr_name)
202
+ column = column_for_attribute(attr_name)
200
203
 
201
- @attributes[attr_name] = type_cast_attribute_for_write(column, value)
204
+ @attributes[attr_name] = type_cast_attribute_for_write(column, value)
205
+ end
202
206
  end
203
207
  end
204
208
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calculated_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Schneider
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-30 00:00:00.000000000 Z
11
+ date: 2015-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal