sequel_dm 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sequel_dm/dao.rb +6 -0
- data/lib/sequel_dm/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f084e7ea68702d55ac369cb306fd88284659042a
|
4
|
+
data.tar.gz: eef1fac6de543a4f7cdc584f1beb465ca38bf4ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dcc62bc2dd31183e8c508e56089156d96fbb60f566a246b2c886682b76e626d4ff6f3ccfee6240f3d805300239c88dabd2393495867e89bcb2cf8e7fbe46c70
|
7
|
+
data.tar.gz: 861fca6b3d06642b563b5638dcb2ffad32b8f40faafba99286e42952da579111744660e26de84227debfe92b14c24b71eee0c7d591f1ed232356150ead4072a6
|
data/Gemfile.lock
CHANGED
data/lib/sequel_dm/dao.rb
CHANGED
@@ -269,6 +269,9 @@ module SequelDM
|
|
269
269
|
def insert_or_update_associations(entity)
|
270
270
|
unless association_reflections.empty?
|
271
271
|
association_reflections.each do |association_name, options|
|
272
|
+
if options[:if] && !options[:if].call(entity)
|
273
|
+
next
|
274
|
+
end
|
272
275
|
association_dao = options[:class]
|
273
276
|
raise ArgumentError, "class option should be specified for #{association_name}" unless association_dao
|
274
277
|
|
@@ -284,6 +287,9 @@ module SequelDM
|
|
284
287
|
def delete_associations(entity)
|
285
288
|
unless association_reflections.empty?
|
286
289
|
association_reflections.each do |association, options|
|
290
|
+
if options[:if] && !options[:if].call(entity)
|
291
|
+
next
|
292
|
+
end
|
287
293
|
if options[:delete]
|
288
294
|
association_dao = options[:class]
|
289
295
|
conditions = (options[:conditions] || {}).merge(options[:key] => entity.send(primary_key))
|
data/lib/sequel_dm/version.rb
CHANGED