mongomodel 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
- gem "bson_ext", '~> 1.2.0'
4
+
5
+ gem "bson_ext", '~> 1.3.0'
6
+ gem "SystemTimer"
@@ -29,7 +29,7 @@ module MongoModel
29
29
  end
30
30
 
31
31
  class Property
32
- delegate :cast, :boolean, :to_mongo, :from_mongo, :to => :type_converter
32
+ delegate :cast, :boolean, :to_mongo, :from_mongo, :to_query, :to => :type_converter
33
33
 
34
34
  attr_reader :name, :type, :options
35
35
 
@@ -36,9 +36,9 @@ module MongoModel
36
36
  key = property.as
37
37
 
38
38
  if k.is_a?(MongoOperator)
39
- value = k.to_mongo_selector(v.is_a?(Array) ? v.map { |i| property.to_mongo(property.cast(i)) } : property.to_mongo(property.cast(v)))
39
+ value = k.to_mongo_selector(v.is_a?(Array) ? v.map { |i| property.to_query(i) } : property.to_query(v))
40
40
  else
41
- value = property.to_mongo(property.cast(v))
41
+ value = property.to_query(v)
42
42
  end
43
43
  else
44
44
  converter = Types.converter_for(value.class)
@@ -10,6 +10,8 @@ module MongoModel
10
10
  id.to_s
11
11
  end
12
12
 
13
+ alias :to_str :to_s
14
+
13
15
  def hash
14
16
  id.hash
15
17
  end
@@ -110,6 +110,8 @@ module MongoModel
110
110
  def reset
111
111
  @loaded = nil
112
112
  @documents = []
113
+ @finder_options = nil
114
+ @options_for_create = nil
113
115
  self
114
116
  end
115
117
 
@@ -6,6 +6,10 @@ module MongoModel
6
6
  Types.converter_for(i.class).to_mongo(i)
7
7
  } if array
8
8
  end
9
+
10
+ def to_query(value)
11
+ Types.converter_for(value.class).to_mongo(value)
12
+ end
9
13
  end
10
14
  end
11
15
  end
@@ -16,6 +16,10 @@ module MongoModel
16
16
  def from_mongo(value)
17
17
  value
18
18
  end
19
+
20
+ def to_query(value)
21
+ to_mongo(cast(value))
22
+ end
19
23
  end
20
24
  end
21
25
  end
@@ -1,3 +1,3 @@
1
1
  module MongoModel
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_dependency "activesupport", "~> 3.0.3"
18
18
  s.add_dependency "activemodel", "~> 3.0.3"
19
- s.add_dependency "mongo", "~> 1.1.2"
19
+ s.add_dependency "mongo", "~> 1.3.0"
20
20
  s.add_dependency "will_paginate", "~> 2.3.15"
21
21
 
22
22
  s.add_development_dependency "bundler", ">= 1.0.0"
@@ -183,6 +183,16 @@ module MongoModel
183
183
  subject.reload
184
184
  subject.should be_loaded
185
185
  end
186
+
187
+ it "should reset its finder options" do
188
+ old_finder_options = subject.finder_options
189
+ subject.reload.finder_options.should_not equal(old_finder_options)
190
+ end
191
+
192
+ it "should reset its options for create" do
193
+ old_options_for_create = subject.options_for_create
194
+ subject.reload.options_for_create.should_not equal(old_options_for_create)
195
+ end
186
196
  end
187
197
  end
188
198
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongomodel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sam Pohlenz
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-07 00:00:00 +10:30
18
+ date: 2011-04-19 00:00:00 +09:30
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -58,12 +58,12 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- hash: 23
61
+ hash: 27
62
62
  segments:
63
63
  - 1
64
- - 1
65
- - 2
66
- version: 1.1.2
64
+ - 3
65
+ - 0
66
+ version: 1.3.0
67
67
  type: :runtime
68
68
  version_requirements: *id003
69
69
  - !ruby/object:Gem::Dependency
@@ -305,7 +305,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
305
  requirements: []
306
306
 
307
307
  rubyforge_project: mongomodel
308
- rubygems_version: 1.4.2
308
+ rubygems_version: 1.6.1
309
309
  signing_key:
310
310
  specification_version: 3
311
311
  summary: MongoDB ORM for Ruby/Rails