shadow_model 0.2.1 → 0.2.2

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: 77dd86c44aa28c1d3769e3a2e94d0b65bb068aad
4
- data.tar.gz: 1d2e7adb2ceea4e8573f5548bdbff67605fbe39c
3
+ metadata.gz: aa2e4498f41912b4007f8f6eec30ca960bacb884
4
+ data.tar.gz: 9cf8fad4b6222b2eadee1632961155068b579e3e
5
5
  SHA512:
6
- metadata.gz: 9fac0b344008998f6cf3aa8c480ddb31fa465c0fe388b4195035bccd81a124c598c3d53449e7523548c5acb7d194bbbb758d6d5af7a57d9ec8ba58e0f92eae7c
7
- data.tar.gz: 6920f6940bbe251096e70334546d9fdd2b14949d831e24f35c1e41e378942435de947b3b18c4dc819d14c5f375d0db9e71c9dd183178f164750343b41ae3bd90
6
+ metadata.gz: 3e69b2bcdb761a752817d645cda407a9995e928b3d766083584aaf61ba54adb9471c1f639b2c8615dadfedb845234d2ffc087325fac27186abc39c0e93f7e9c0
7
+ data.tar.gz: 56c45f612993c3b4469e429e3e0e844fc5262610bdb3400d9f626823331c755f734b0c173382381d82faae5b43fb55136081e1bf1cf2ba81d1cd86eca157687f
@@ -1,8 +1,12 @@
1
1
  class ::ActiveRecord::Associations::Builder::HasMany
2
- def valid_options_with_shadow_option
3
- valid_options_without_shadow_option + [:shadow]
2
+ if self.respond_to?(:valid_options=)
3
+ self.valid_options += [:shadow]
4
+ else
5
+ def valid_options_with_shadow_option
6
+ valid_options_without_shadow_option + [:shadow]
7
+ end
8
+ alias_method_chain :valid_options, :shadow_option
4
9
  end
5
- alias_method_chain :valid_options, :shadow_option
6
10
 
7
11
  def build_with_shadow_option
8
12
  reflection = build_without_shadow_option
@@ -80,7 +80,7 @@ module ShadowModel
80
80
  end
81
81
 
82
82
  def shadow_keys
83
- @shadow_attributes + @shadow_methods
83
+ (@shadow_attributes || []) + (@shadow_methods || [])
84
84
  end
85
85
 
86
86
  def method_added(method_name)
@@ -1,3 +1,3 @@
1
1
  module ShadowModel
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shadow_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weihu Chen