datamapper-shim 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datamapper-shim (0.0.1)
4
+ datamapper-shim (0.0.2)
5
5
  activerecord (~> 3.2.0)
6
6
  composite_primary_keys (~> 5.0.0)
7
7
  json (~> 1.4)
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "datamapper-shim"
7
- spec.version = "0.0.2"
7
+ spec.version = "0.0.3"
8
8
  spec.authors = ["ecin"]
9
9
  spec.email = ["ecin@copypastel.com"]
10
10
  spec.description = "Dress ActiveRecord models in DataMapper robes"
@@ -116,7 +116,7 @@ module DataMapper
116
116
  obs_domain = "#{atom}([.]#{atom})*"
117
117
  domain = "(?:#{dot_atom}|#{domain_literal}|#{obs_domain})"
118
118
  addr_spec = "#{local_part}\@#{domain}"
119
- pattern = /^#{addr_spec}$/
119
+ pattern = /^#{addr_spec}$/n
120
120
  end
121
121
 
122
122
  # Helpers
@@ -328,7 +328,12 @@ module DataMapper
328
328
  @__datamapper_shim_primary_keys ||= []
329
329
  @__datamapper_shim_primary_keys << name
330
330
 
331
- self.primary_keys = *@__datamapper_shim_primary_keys
331
+ if @__datamapper_shim_primary_keys.length == 1
332
+ self.primary_key = @__datamapper_shim_primary_keys.first
333
+ else
334
+ self.primary_keys = *@__datamapper_shim_primary_keys
335
+ end
336
+
332
337
  validates_presence_of name
333
338
  end
334
339
 
@@ -415,9 +420,9 @@ module DataMapper
415
420
  # Here, we capture the exception AR raises if a model
416
421
  # can't be destroyed due to an association.
417
422
  self.instance_eval do
418
- define_method(:destroy) do
423
+ define_method(:destroy) do |*args|
419
424
  begin
420
- super
425
+ super(*args)
421
426
  rescue ActiveRecord::DeleteRestrictionError => e
422
427
  false
423
428
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datamapper-shim
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - ecin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2014-02-28 00:00:00 Z
18
+ date: 2014-03-04 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: json