granite 0.8.2 → 0.8.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: 3792e5a0bab26cb24becc52bb82e89198a74e84f
4
- data.tar.gz: 1c085cd86ae0ca9379cfd8d6708a24dea36a6454
3
+ metadata.gz: a80b109dbceea5353225c682dac91eb5c3bc18ed
4
+ data.tar.gz: c995edf2a35d481bf68efa13c58abcd30afe876b
5
5
  SHA512:
6
- metadata.gz: b1afd8ebb16b30ac0a5142369cb7bcb5ac62ab9c1d11a2c5ec84b0a525a70b43b0181e51aed50003384baa4303c0eb466440216acf345d66a7cde594e594e6de
7
- data.tar.gz: 8bd7ef7aff11fa0f9aaa444993c637cffe2ff7f2c8dfc1b39ec1680d5766a32f5d0bd40a3bfc6fe17f9020a08df40d1777ffff942ea6507e3ed68d40e6edbb26
6
+ metadata.gz: ff37abbb9cd3326be35840912a9d4ec0fd3b107bccd95465a51925101897c17e2cc05a5378f2d262327e061f4b9d26924b0b1f79063d3b38da5e6e517328f82e
7
+ data.tar.gz: 81f809088a68c5769c901bdfbb4ed5d8e93ec1f3148b0e1886d8e82c70cf92efdb669a8f6c6cca85f9515b9ae66d71ba60b06b19b47cb09f6ec35cde8d3a8a86
@@ -14,7 +14,7 @@ module Granite
14
14
  add_attribute Granite::Represents::Reflection, field, options, &block
15
15
 
16
16
  before_validation do
17
- attribute(field).sync if __send__ "#{field}_changed?"
17
+ attribute(field).sync if attribute(field).changed?
18
18
  true
19
19
  end
20
20
  end
@@ -33,6 +33,14 @@ module Granite
33
33
  end
34
34
  end
35
35
 
36
+ def changed?
37
+ if reflection.options[:default].present?
38
+ reference.public_send(reader) != read
39
+ else
40
+ owner.public_send("#{name}_changed?")
41
+ end
42
+ end
43
+
36
44
  private
37
45
 
38
46
  def reference
@@ -1,3 +1,3 @@
1
1
  module Granite
2
- VERSION = '0.8.2'.freeze
2
+ VERSION = '0.8.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: granite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkadiy Zabazhanov & friends
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-22 00:00:00.000000000 Z
11
+ date: 2018-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack