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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44a6ec9f89b463d1d49304d69514a76108579e85
4
- data.tar.gz: 93b4891878c86f5c165e722fd36d02ef23f10fe8
3
+ metadata.gz: f084e7ea68702d55ac369cb306fd88284659042a
4
+ data.tar.gz: eef1fac6de543a4f7cdc584f1beb465ca38bf4ed
5
5
  SHA512:
6
- metadata.gz: 1efa9c0668559b207aa9b19a6fdad27c8530274897bcd0debf0ac993321f62b5d6aa3a655441b4975ee84e8280ec8329c349d6302b7ee32ee9e1afd6b51a1043
7
- data.tar.gz: 0d4e5c05333eb51ed9b575db63eca2cf7ea2a4ef778d1acc5d8304670e3f5b090803dcdf58ef2dd6cfda14fae52670ccff03468e8ab96e09eed94044a66df39b
6
+ metadata.gz: 3dcc62bc2dd31183e8c508e56089156d96fbb60f566a246b2c886682b76e626d4ff6f3ccfee6240f3d805300239c88dabd2393495867e89bcb2cf8e7fbe46c70
7
+ data.tar.gz: 861fca6b3d06642b563b5638dcb2ffad32b8f40faafba99286e42952da579111744660e26de84227debfe92b14c24b71eee0c7d591f1ed232356150ead4072a6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sequel_dm (0.0.3)
4
+ sequel_dm (0.0.4)
5
5
  activesupport
6
6
  sequel (~> 4.6)
7
7
 
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))
@@ -1,3 +1,3 @@
1
1
  module SequelDM
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_dm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Albert Gazizov