mongoid 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -1
- data/lib/mongoid/attributes.rb +12 -1
- data/lib/mongoid/document.rb +0 -2
- data/lib/mongoid/hierarchy.rb +2 -1
- data/lib/mongoid/sessions.rb +2 -1
- data/lib/mongoid/validations.rb +0 -2
- data/lib/mongoid/version.rb +1 -1
- metadata +3 -3
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,17 @@
|
|
3
3
|
For instructions on upgrading to newer versions, visit
|
4
4
|
[mongoid.org](http://mongoid.org/en/mongoid/docs/upgrading.html).
|
5
5
|
|
6
|
-
## 3.1.
|
6
|
+
## 3.1.1
|
7
|
+
|
8
|
+
* \#2839 Validations fixed to use the type cast value with the exception
|
9
|
+
of the numericality validator. (Lailson Bandeira)
|
10
|
+
|
11
|
+
* \#2838 `store_in` options now properly merge instead of override.
|
12
|
+
(Colin MacKenzie)
|
13
|
+
|
14
|
+
### Resolved Issues
|
15
|
+
|
16
|
+
## 3.1.0
|
7
17
|
|
8
18
|
### New Features
|
9
19
|
|
data/lib/mongoid/attributes.rb
CHANGED
@@ -12,7 +12,6 @@ module Mongoid
|
|
12
12
|
include Readonly
|
13
13
|
|
14
14
|
attr_reader :attributes
|
15
|
-
attr_reader :attributes_before_type_cast
|
16
15
|
alias :raw_attributes :attributes
|
17
16
|
|
18
17
|
# Determine if an attribute is present.
|
@@ -30,6 +29,18 @@ module Mongoid
|
|
30
29
|
!attribute.blank? || attribute == false
|
31
30
|
end
|
32
31
|
|
32
|
+
# Get the attributes that have not been cast.
|
33
|
+
#
|
34
|
+
# @example Get the attributes before type cast.
|
35
|
+
# document.attributes_before_type_cast
|
36
|
+
#
|
37
|
+
# @return [ Hash ] The uncast attributes.
|
38
|
+
#
|
39
|
+
# @since 3.1.0
|
40
|
+
def attributes_before_type_cast
|
41
|
+
@attributes_before_type_cast ||= {}
|
42
|
+
end
|
43
|
+
|
33
44
|
# Does the document have the provided attribute?
|
34
45
|
#
|
35
46
|
# @example Does the document have the attribute?
|
data/lib/mongoid/document.rb
CHANGED
@@ -89,7 +89,6 @@ module Mongoid
|
|
89
89
|
_building do
|
90
90
|
@new_record = true
|
91
91
|
@attributes ||= {}
|
92
|
-
@attributes_before_type_cast ||= {}
|
93
92
|
options ||= {}
|
94
93
|
apply_pre_processed_defaults
|
95
94
|
process_attributes(attrs, options[:as] || :default, !options[:without_protection]) do
|
@@ -285,7 +284,6 @@ module Mongoid
|
|
285
284
|
doc = allocate
|
286
285
|
doc.criteria_instance_id = criteria_instance_id
|
287
286
|
doc.instance_variable_set(:@attributes, attributes)
|
288
|
-
doc.instance_variable_set(:@attributes_before_type_cast, {})
|
289
287
|
doc.apply_defaults
|
290
288
|
IdentityMap.set(doc) unless _loading_revision?
|
291
289
|
yield(doc) if block_given?
|
data/lib/mongoid/hierarchy.rb
CHANGED
@@ -179,7 +179,8 @@ module Mongoid
|
|
179
179
|
unless fields.has_key?("_type")
|
180
180
|
field(:_type, default: self.name, type: String)
|
181
181
|
end
|
182
|
-
subclass.
|
182
|
+
subclass_default = subclass.name || ->{ self.class.name }
|
183
|
+
subclass.field(:_type, default: subclass_default, type: String)
|
183
184
|
end
|
184
185
|
end
|
185
186
|
end
|
data/lib/mongoid/sessions.rb
CHANGED
@@ -293,7 +293,8 @@ module Mongoid
|
|
293
293
|
def store_in(options)
|
294
294
|
Validators::Storage.validate(self, options)
|
295
295
|
@collection_name, @database_name = nil, nil
|
296
|
-
self.storage_options
|
296
|
+
self.storage_options ||= {}
|
297
|
+
self.storage_options.merge! options
|
297
298
|
end
|
298
299
|
|
299
300
|
# Tell the next persistance operation to store in a specific collection,
|
data/lib/mongoid/validations.rb
CHANGED
data/lib/mongoid/version.rb
CHANGED
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: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -375,7 +375,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
375
375
|
version: 1.3.6
|
376
376
|
requirements: []
|
377
377
|
rubyforge_project: mongoid
|
378
|
-
rubygems_version: 1.8.
|
378
|
+
rubygems_version: 1.8.25
|
379
379
|
signing_key:
|
380
380
|
specification_version: 3
|
381
381
|
summary: Elegant Persistance in Ruby for MongoDB.
|