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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a3f9cfb39bdad6c3d5e0c4f9e98e338dabe64b1c
4
- data.tar.gz: 9555e0057cc0930aebdb32de04b4303bc2aa35a5
3
+ metadata.gz: d5c5f97f11dea2e2730b11cc50d556e6e8135060
4
+ data.tar.gz: e23e07dac4a3027c51e3219a3c32055c2eff75f4
5
5
  SHA512:
6
- metadata.gz: 4913b6ef30424be10cf8ba5255ec0c86a502adddc687970d2f986d9f01fc9219c491650e8bf10d8b5d1737b2cb7283edd79e908125e01f5c59c0dc1e4c1d9a1b
7
- data.tar.gz: 92f38c9128d3549e3c38eb933f88f9f7c89ea124b679941e2c21fc470d2e768a27b8b828f578e0f6af78e24052da2fcc0bce3aee9d44bc34b62594c7efb6ca65
6
+ metadata.gz: e8855c56699aea80739490f89065dbd7970c3bae9d0c14b44ae21cd5d273b2986a0399e3b79ce665643c944de148885045aec7ca4afe4dfc5702b3cdef1f1093
7
+ data.tar.gz: c6b771298d9e90f87a848310f100a3401ae66452fe55f15e3ea395628146ab54292030775301b51d384d0a8201af996612508561d3cc92e6d76c5b178e8212c6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- deferring (0.1.2)
4
+ deferring (0.1.3)
5
5
  activerecord (> 3.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- deferring (0.1.2)
4
+ deferring (0.1.3)
5
5
  activerecord (> 3.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- deferring (0.1.2)
4
+ deferring (0.1.3)
5
5
  activerecord (> 3.0)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- deferring (0.1.2)
4
+ deferring (0.1.3)
5
5
  activerecord (> 3.0)
6
6
 
7
7
  GEM
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 !deferred_reject_new_record?(attributes)
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 :deferred_reject_new_record? do |attributes|
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' || deferred_call_reject_if(attributes)
114
+ attributes['_destroy'] == '1' || send(:"deferred_#{association_name}_call_reject_if", attributes)
115
115
  end
116
116
 
117
- define_method :deferred_call_reject_if do |attributes|
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
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module Deferring
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
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.3
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-03 00:00:00.000000000 Z
11
+ date: 2015-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord