deferred_associations 0.6.3 → 0.6.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/CHANGELOG +5 -0
- data/Readme.markdown +1 -1
- data/VERSION +1 -1
- data/deferred_associations.gemspec +2 -2
- data/lib/has_and_belongs_to_many_with_deferred_save.rb +6 -5
- data/lib/has_many_with_deferred_save.rb +2 -2
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eb06150c83e5fbcc9784e59d4ac930a78549d31
|
4
|
+
data.tar.gz: c55f5ec4758ae4bed1cce95a3250f0380c5e6a64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6458c1ce77f68884da941359b25925d70fec9e1b054ad9902b2dcab7f989d688f0e1ec1a78ba33cb2d7d1300b0c87e96bd608d8f0b0711587cbe651e3fa130f5
|
7
|
+
data.tar.gz: fbed599d94b0139b531a951684a3fbc6e50349a58ea790f48dc7dba7f28b69607846197714c90ed962058b7f285fe5a555f9404309d098bd22dd0680787c3db7
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
0.6.4
|
2
|
+
=====
|
3
|
+
* the after_save action on has_and_belongs_to_many associations is only done, if the association was loaded
|
4
|
+
before ( same behavior like has_many; prevents loading of all associations after save)
|
5
|
+
|
1
6
|
0.6.3
|
2
7
|
=====
|
3
8
|
* Revert Changes form 0.6.1/0.6.2
|
data/Readme.markdown
CHANGED
@@ -46,7 +46,7 @@ end
|
|
46
46
|
Compatibility
|
47
47
|
=============
|
48
48
|
|
49
|
-
Tested with Rails 2.3.18, 3.2.22, 4.1.14, 4.2.
|
49
|
+
Tested with Rails 2.3.18, 3.2.22, 4.1.14, 4.2.6 on Ruby 1.9.3, 2.2.4, 2.3.1 and JRuby 1.7, JRuby 9.1.1.0
|
50
50
|
|
51
51
|
Note, that Rails 3.2.14 associations are partly broken under JRuby cause of https://github.com/rails/rails/issues/11595
|
52
52
|
You'll need to upgrade activerecord-jdbc-adapter to >= 1.3.0.beta1, if you want to use this combination.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.4
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'deferred_associations'
|
5
|
-
s.version = '0.6.
|
5
|
+
s.version = '0.6.4'
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ['Martin Koerner', 'Tyler Rick', 'Alessio Caiazza']
|
9
|
-
s.date = '2016-05-
|
9
|
+
s.date = '2016-05-23'
|
10
10
|
s.description = "Makes ActiveRecord defer/postpone saving the records you add to an habtm (has_and_belongs_to_many) or has_many\n association until you call model.save, allowing validation in the style of normal attributes. Additionally you\n can check inside before_save filters, if the association was altered."
|
11
11
|
s.email = 'martin.koerner@objectfab.de'
|
12
12
|
s.licenses = 'MIT'
|
@@ -77,13 +77,14 @@ module ActiveRecord
|
|
77
77
|
# But we only want the old behavior in this case -- most of the time we want the *new* behavior -- so we use
|
78
78
|
# @use_original_collection_reader_behavior as a switch.
|
79
79
|
|
80
|
-
send
|
81
|
-
|
80
|
+
unless send("unsaved_#{collection_name}").nil?
|
81
|
+
send "use_original_collection_reader_behavior_for_#{collection_name}=", true
|
82
82
|
|
83
|
-
|
84
|
-
|
83
|
+
# vv This is where the actual save occurs vv
|
84
|
+
send "#{collection_name}_without_deferred_save=", send("unsaved_#{collection_name}")
|
85
85
|
|
86
|
-
|
86
|
+
send "use_original_collection_reader_behavior_for_#{collection_name}=", false
|
87
|
+
end
|
87
88
|
true
|
88
89
|
end
|
89
90
|
after_save "do_#{collection_name}_save!"
|
@@ -15,7 +15,7 @@ module ActiveRecord
|
|
15
15
|
|
16
16
|
after_save "hmwds_update_#{collection_name}"
|
17
17
|
|
18
|
-
define_obj_setter collection_name
|
18
|
+
define_obj_setter collection_name
|
19
19
|
define_obj_getter collection_name
|
20
20
|
define_id_setter collection_name, collection_singular_ids
|
21
21
|
define_id_getter collection_name, collection_singular_ids
|
@@ -24,7 +24,7 @@ module ActiveRecord
|
|
24
24
|
define_reload_method collection_name
|
25
25
|
end
|
26
26
|
|
27
|
-
def define_obj_setter(collection_name
|
27
|
+
def define_obj_setter(collection_name)
|
28
28
|
define_method("#{collection_name}_with_deferred_save=") do |objs|
|
29
29
|
instance_variable_set "@hmwds_temp_#{collection_name}", objs || []
|
30
30
|
attribute_will_change!(collection_name) if objs != send("#{collection_name}_without_deferred_save")
|
metadata
CHANGED
@@ -1,40 +1,40 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deferred_associations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Koerner
|
8
8
|
- Tyler Rick
|
9
9
|
- Alessio Caiazza
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-05-
|
13
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name: activerecord
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
17
|
requirements:
|
19
18
|
- - ">="
|
20
19
|
- !ruby/object:Gem::Version
|
21
20
|
version: '0'
|
22
|
-
|
21
|
+
name: activerecord
|
23
22
|
prerelease: false
|
23
|
+
type: :runtime
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '0'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
|
-
name: rspec
|
31
30
|
requirement: !ruby/object:Gem::Requirement
|
32
31
|
requirements:
|
33
32
|
- - ">="
|
34
33
|
- !ruby/object:Gem::Version
|
35
34
|
version: '0'
|
36
|
-
|
35
|
+
name: rspec
|
37
36
|
prerelease: false
|
37
|
+
type: :development
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - ">="
|
@@ -76,7 +76,7 @@ homepage: http://github.com/MartinKoerner/deferred_associations
|
|
76
76
|
licenses:
|
77
77
|
- MIT
|
78
78
|
metadata: {}
|
79
|
-
post_install_message:
|
79
|
+
post_install_message:
|
80
80
|
rdoc_options: []
|
81
81
|
require_paths:
|
82
82
|
- lib
|
@@ -91,9 +91,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
|
-
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
96
|
-
signing_key:
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.6.4
|
96
|
+
signing_key:
|
97
97
|
specification_version: 3
|
98
98
|
summary: Makes ActiveRecord defer/postpone habtm or has_many associations
|
99
99
|
test_files: []
|