mongoid 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -94,7 +94,9 @@ module Mongoid #:nodoc:
94
94
  def write_attribute(name, value)
95
95
  access = name.to_s
96
96
  typed_value_for(access, value).tap do |value|
97
- attribute_will_change!(access) unless attributes[access] == value || attribute_changed?(access)
97
+ unless attributes[access] == value || attribute_changed?(access)
98
+ attribute_will_change!(access)
99
+ end
98
100
  attributes[access] = value
99
101
  end
100
102
  end
@@ -56,6 +56,7 @@ module Mongoid #:nodoc:
56
56
  #
57
57
  # @example Is the document destroyed?
58
58
  # person.destroyed?
59
+
59
60
  #
60
61
  # @return [ true, false ] If the document is destroyed.
61
62
  def destroyed?
@@ -83,8 +84,8 @@ module Mongoid #:nodoc:
83
84
  # @param [ Array ] args The arguments.
84
85
  #
85
86
  # @return [ Criteria ] The paranoid compliant criteria.
86
- def criteria(*args)
87
- super.where(:deleted_at.exists => false)
87
+ def criteria(embedded = false, scoped = true)
88
+ scoped ? super.where(:deleted_at.exists => false) : super
88
89
  end
89
90
 
90
91
  # Find deleted documents
@@ -95,7 +95,8 @@ module Mongoid #:nodoc:
95
95
  #
96
96
  # @since 2.0.0.rc.6
97
97
  def update_attribute(name, value)
98
- write_attribute(name, value) ? save(:validate => false) : true
98
+ write_attribute(name, value)
99
+ save(:validate => false)
99
100
  end
100
101
 
101
102
  # Update the document attributes in the datbase.
@@ -37,7 +37,7 @@ module Mongoid # :nodoc:
37
37
  def query?
38
38
  return true unless object.respond_to?(:to_a)
39
39
  obj = object.to_a.first
40
- !obj.respond_to?(:attributes) && !obj.nil?
40
+ !obj.is_a?(Mongoid::Document) && !obj.nil?
41
41
  end
42
42
  end
43
43
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid #:nodoc
3
- VERSION = "2.1.0"
3
+ VERSION = "2.1.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
17
- requirement: &2151804880 !ruby/object:Gem::Requirement
17
+ requirement: &2151817520 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '3.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2151804880
25
+ version_requirements: *2151817520
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: tzinfo
28
- requirement: &2151801860 !ruby/object:Gem::Requirement
28
+ requirement: &2151806700 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.3.22
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2151801860
36
+ version_requirements: *2151806700
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: mongo
39
- requirement: &2151797660 !ruby/object:Gem::Requirement
39
+ requirement: &2151801860 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '1.3'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2151797660
47
+ version_requirements: *2151801860
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rdoc
50
- requirement: &2151795140 !ruby/object:Gem::Requirement
50
+ requirement: &2151792280 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 3.5.0
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2151795140
58
+ version_requirements: *2151792280
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: bson_ext
61
- requirement: &2151787380 !ruby/object:Gem::Requirement
61
+ requirement: &2151790140 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '1.3'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *2151787380
69
+ version_requirements: *2151790140
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: mocha
72
- requirement: &2151781760 !ruby/object:Gem::Requirement
72
+ requirement: &2151788460 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - =
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 0.9.8
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *2151781760
80
+ version_requirements: *2151788460
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rspec
83
- requirement: &2151780340 !ruby/object:Gem::Requirement
83
+ requirement: &2151786380 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '2.6'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *2151780340
91
+ version_requirements: *2151786380
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: watchr
94
- requirement: &2151778340 !ruby/object:Gem::Requirement
94
+ requirement: &2151784760 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - =
@@ -99,7 +99,7 @@ dependencies:
99
99
  version: '0.6'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *2151778340
102
+ version_requirements: *2151784760
103
103
  description: Mongoid is an ODM (Object Document Mapper) Framework for MongoDB, written
104
104
  in Ruby.
105
105
  email:
@@ -380,7 +380,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
380
380
  version: '0'
381
381
  segments:
382
382
  - 0
383
- hash: 1489786607886751452
383
+ hash: -4071051164423379877
384
384
  required_rubygems_version: !ruby/object:Gem::Requirement
385
385
  none: false
386
386
  requirements: