deferring 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/gemfiles/rails_30.gemfile.lock +1 -1
- data/gemfiles/rails_32.gemfile.lock +1 -1
- data/gemfiles/rails_40.gemfile.lock +1 -1
- data/gemfiles/rails_41.gemfile.lock +1 -1
- data/lib/deferring.rb +4 -4
- data/lib/deferring/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d5c5f97f11dea2e2730b11cc50d556e6e8135060
|
|
4
|
+
data.tar.gz: e23e07dac4a3027c51e3219a3c32055c2eff75f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e8855c56699aea80739490f89065dbd7970c3bae9d0c14b44ae21cd5d273b2986a0399e3b79ce665643c944de148885045aec7ca4afe4dfc5702b3cdef1f1093
|
|
7
|
+
data.tar.gz: c6b771298d9e90f87a848310f100a3401ae66452fe55f15e3ea395628146ab54292030775301b51d384d0a8201af996612508561d3cc92e6d76c5b178e8212c6
|
data/lib/deferring.rb
CHANGED
|
@@ -73,7 +73,7 @@ module Deferring
|
|
|
73
73
|
attributes = attributes.with_indifferent_access
|
|
74
74
|
|
|
75
75
|
if attributes['id'].blank?
|
|
76
|
-
if !
|
|
76
|
+
if !send(:"deferred_#{association_name}_reject_new_record?", attributes)
|
|
77
77
|
send(:"#{association_name}").build(attributes.except(*deferred_unassignable_keys))
|
|
78
78
|
end
|
|
79
79
|
|
|
@@ -109,12 +109,12 @@ module Deferring
|
|
|
109
109
|
# Determines if a new record should be build by checking for
|
|
110
110
|
# has_destroy_flag? or if a <tt>:reject_if</tt> proc exists for this
|
|
111
111
|
# association and evaluates to +true+.
|
|
112
|
-
define_method :
|
|
112
|
+
define_method :"deferred_#{association_name}_reject_new_record?" do |attributes|
|
|
113
113
|
# TODO: Implement value_to_boolean code from rails for checking _destroy field.
|
|
114
|
-
attributes['_destroy'] == '1' ||
|
|
114
|
+
attributes['_destroy'] == '1' || send(:"deferred_#{association_name}_call_reject_if", attributes)
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
-
define_method :
|
|
117
|
+
define_method :"deferred_#{association_name}_call_reject_if" do |attributes|
|
|
118
118
|
return false if attributes['_destroy'] == '1'
|
|
119
119
|
case callback = reject_if
|
|
120
120
|
when Symbol
|
data/lib/deferring/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: deferring
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robin Roestenburg
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-04-
|
|
11
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|