mongo_mapper 0.13.0.beta2 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +6 -2
- data/examples/keys.rb +2 -2
- data/examples/modifiers/set.rb +1 -1
- data/examples/querying.rb +2 -2
- data/lib/mongo_mapper/connection.rb +0 -0
- data/lib/mongo_mapper/connections/10gen.rb +0 -0
- data/lib/mongo_mapper/connections/moped.rb +0 -0
- data/lib/mongo_mapper/plugins/associations/one_as_proxy.rb +3 -3
- data/lib/mongo_mapper/plugins/callbacks.rb +1 -1
- data/lib/mongo_mapper/plugins/indexes.rb +30 -2
- data/lib/mongo_mapper/plugins/keys.rb +50 -1
- data/lib/mongo_mapper/plugins/keys/key.rb +6 -3
- data/lib/mongo_mapper/plugins/modifiers.rb +13 -0
- data/lib/mongo_mapper/plugins/querying/decorated_plucky_query.rb +20 -1
- data/lib/mongo_mapper/plugins/sci.rb +4 -1
- data/lib/mongo_mapper/plugins/touch.rb +1 -1
- data/lib/mongo_mapper/plugins/validations.rb +7 -2
- data/lib/mongo_mapper/railtie.rb +20 -0
- data/lib/mongo_mapper/railtie/database.rake +1 -1
- data/lib/mongo_mapper/version.rb +1 -1
- data/spec/functional/embedded_document_spec.rb +1 -1
- data/spec/functional/indexes_spec.rb +33 -9
- data/spec/functional/keys_spec.rb +64 -2
- data/spec/functional/sci_spec.rb +40 -5
- data/spec/functional/touch_spec.rb +5 -5
- data/spec/unit/inspect_spec.rb +4 -4
- data/spec/unit/model_generator_spec.rb +2 -4
- metadata +159 -157
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd7ff4dfcd2b6bce162c7b55ba45e8c00e38a461
|
4
|
+
data.tar.gz: 673686bd40a1c139e2045b5397802239cd5d894c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36943d83bc3ddff1cd8c82d8bddfdde2fa3dfae12800f4c93260480185925e1f34e5a8622b7682b176a318579ee723339286a5c5b99678e9731301e475fb183b
|
7
|
+
data.tar.gz: 039605ede2145f91ef107e39dc91d43db57906be355737198fe0a1cff97a2eeb821a9a9460fa977f1a2cc520cdf07c1177994db5ad623e298203e50e6f5838a4
|
data/README.rdoc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= MongoMapper
|
2
2
|
|
3
3
|
{<img src="https://badge.fury.io/rb/mongo_mapper.png" alt="RubyGem" />}[https://rubygems.org/gems/mongo_mapper]
|
4
|
-
{<img src="https://travis-ci.org/
|
4
|
+
{<img src="https://travis-ci.org/mongomapper/mongomapper.png?branch=master" alt="Build Status" />}[https://travis-ci.org/mongomapper/mongomapper]
|
5
5
|
{<img src="https://coveralls.io/repos/jnunemaker/mongomapper/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/jnunemaker/mongomapper]
|
6
6
|
|
7
7
|
A Ruby Object Mapper for Mongo.
|
@@ -23,7 +23,7 @@ MongoMapper is tested against:
|
|
23
23
|
* MRI 1.8.7
|
24
24
|
* MRI 1.9.3
|
25
25
|
* MRI 2.0.0
|
26
|
-
* JRuby (1.9)
|
26
|
+
* JRuby (Versions with 1.9 compatibility)
|
27
27
|
|
28
28
|
Additionally, MongoMapper is tested against:
|
29
29
|
|
@@ -32,6 +32,10 @@ Additionally, MongoMapper is tested against:
|
|
32
32
|
* Rails 3.2.x
|
33
33
|
* Rails 4.0.x
|
34
34
|
|
35
|
+
NOTE: Rails 4 support is only in the v0.13.0 beta, which is not currently the default in RubyGems. Use the following line in your gemfile to use the beta:
|
36
|
+
|
37
|
+
gem 'mongo_mapper', :git => "git://github.com/mongomapper/mongomapper.git", :tag => "v0.13.0.beta2"
|
38
|
+
|
35
39
|
== Contributing & Development
|
36
40
|
|
37
41
|
$ git clone https://github.com/jnunemaker/mongomapper && cd mongomapper
|
data/examples/keys.rb
CHANGED
@@ -24,7 +24,7 @@ john = User.create({
|
|
24
24
|
:age => 28,
|
25
25
|
:skills => ['ruby', 'mongo', 'javascript'],
|
26
26
|
:links => {"Google" => "http://www.google.com"}
|
27
|
-
})
|
27
|
+
})
|
28
28
|
|
29
29
|
steve = User.create({
|
30
30
|
:first_name => 'Steve',
|
@@ -37,4 +37,4 @@ john.friend_ids << steve.id.to_s # will get typecast to ObjectId
|
|
37
37
|
john.links["Ruby on Rails"] = "http://www.rubyonrails.com"
|
38
38
|
john.save
|
39
39
|
|
40
|
-
pp john
|
40
|
+
pp john
|
data/examples/modifiers/set.rb
CHANGED
data/examples/querying.rb
CHANGED
@@ -6,7 +6,7 @@ MongoMapper.database = 'testing'
|
|
6
6
|
|
7
7
|
class User
|
8
8
|
include MongoMapper::Document
|
9
|
-
|
9
|
+
|
10
10
|
key :name, String
|
11
11
|
key :tags, Array
|
12
12
|
end
|
@@ -32,4 +32,4 @@ User.create(:name => 'Steve', :tags => %w[html5 css3], :age => 27)
|
|
32
32
|
].each do |result|
|
33
33
|
pp result
|
34
34
|
puts
|
35
|
-
end
|
35
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -7,16 +7,16 @@ module MongoMapper
|
|
7
7
|
def criteria
|
8
8
|
{type_key_name => proxy_owner.class.name, id_key_name => proxy_owner.id}
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
private
|
12
12
|
def type_key_name
|
13
13
|
"#{options[:as]}_type"
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def id_key_name
|
17
17
|
"#{options[:as]}_id"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
22
|
-
end
|
22
|
+
end
|
@@ -5,8 +5,36 @@ module MongoMapper
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
module ClassMethods
|
8
|
-
|
9
|
-
|
8
|
+
def ensure_index(spec, options = {})
|
9
|
+
collection.ensure_index dealias_options(spec), options
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_index(spec, options = {})
|
13
|
+
collection.create_index dealias_options(spec), options
|
14
|
+
end
|
15
|
+
|
16
|
+
def drop_index(name)
|
17
|
+
collection.drop_index name
|
18
|
+
end
|
19
|
+
|
20
|
+
def drop_indexes
|
21
|
+
collection.drop_indexes
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def dealias_options(options)
|
27
|
+
case options
|
28
|
+
when Symbol, String
|
29
|
+
abbr(options)
|
30
|
+
when Hash
|
31
|
+
dealias_keys(options)
|
32
|
+
when Array
|
33
|
+
options.map {|o| dealias_options(o) }
|
34
|
+
else
|
35
|
+
options
|
36
|
+
end
|
37
|
+
end
|
10
38
|
end
|
11
39
|
end
|
12
40
|
end
|
@@ -35,6 +35,24 @@ module MongoMapper
|
|
35
35
|
@unaliased_keys ||= Hash[*keys.select {|k, v| k == v.name }.flatten(1)]
|
36
36
|
end
|
37
37
|
|
38
|
+
def dealias_keys(hash)
|
39
|
+
out = {}
|
40
|
+
hash.each do |k, v|
|
41
|
+
key = keys[k.to_s]
|
42
|
+
name = key && key.abbr || k
|
43
|
+
out[name] = k.to_s.match(/^\$/) && v.is_a?(Hash) ? dealias_keys(v) : v
|
44
|
+
end
|
45
|
+
out
|
46
|
+
end
|
47
|
+
|
48
|
+
def dealias_key(name)
|
49
|
+
key = keys[name.to_s]
|
50
|
+
key && key.abbr || k
|
51
|
+
end
|
52
|
+
|
53
|
+
alias_method :dealias, :dealias_keys
|
54
|
+
alias_method :unalias, :dealias_keys
|
55
|
+
|
38
56
|
def key(*args)
|
39
57
|
Key.new(*args).tap do |key|
|
40
58
|
keys[key.name] = key
|
@@ -47,8 +65,26 @@ module MongoMapper
|
|
47
65
|
end
|
48
66
|
end
|
49
67
|
|
68
|
+
def remove_key(name)
|
69
|
+
if key = keys[name.to_s]
|
70
|
+
keys.delete key.name
|
71
|
+
keys.delete key.abbr
|
72
|
+
remove_method key.name if respond_to? "#{key.name}"
|
73
|
+
remove_method "#{key.name}=" if respond_to? "#{key.name}="
|
74
|
+
remove_method "#{key.name}?" if respond_to? "#{key.name}?"
|
75
|
+
remove_method "#{key.name}_before_type_cast" if respond_to? "#{key.name}_before_type_cast"
|
76
|
+
remove_key_in_descendants key.name
|
77
|
+
remove_validations_for key.name
|
78
|
+
@dynamic_keys = @defined_keys = @unaliased_keys = @object_id_keys = nil
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
50
82
|
def persisted_name(name)
|
51
|
-
keys[name.to_s]
|
83
|
+
if key = keys[name.to_s]
|
84
|
+
key.persisted_name
|
85
|
+
else
|
86
|
+
name
|
87
|
+
end
|
52
88
|
end
|
53
89
|
alias_method :abbr, :persisted_name
|
54
90
|
|
@@ -149,6 +185,10 @@ module MongoMapper
|
|
149
185
|
descendants.each { |descendant| descendant.key(*args) }
|
150
186
|
end
|
151
187
|
|
188
|
+
def remove_key_in_descendants(name)
|
189
|
+
descendants.each { |descendant| descendant.remove_key(name) }
|
190
|
+
end
|
191
|
+
|
152
192
|
def create_indexes_for(key)
|
153
193
|
if key.options[:index] && !key.embeddable?
|
154
194
|
warn "[DEPRECATION] :index option when defining key #{key.name.inspect} is deprecated. Put indexes in `db/indexes.rb`"
|
@@ -200,6 +240,14 @@ module MongoMapper
|
|
200
240
|
validates_length_of(attribute, length_options)
|
201
241
|
end
|
202
242
|
end
|
243
|
+
|
244
|
+
def remove_validations_for(name)
|
245
|
+
name = name.to_sym
|
246
|
+
a_name = [name]
|
247
|
+
|
248
|
+
_validators.reject!{ |key, _| key == name }
|
249
|
+
_validate_callbacks.reject! {|callback| callback.raw_filter.attributes == a_name }
|
250
|
+
end
|
203
251
|
end
|
204
252
|
|
205
253
|
def initialize(attrs={})
|
@@ -389,6 +437,7 @@ module MongoMapper
|
|
389
437
|
@_dynamic_attributes[key.name.to_sym] = as_typecast
|
390
438
|
end
|
391
439
|
@attributes = nil
|
440
|
+
value
|
392
441
|
end
|
393
442
|
|
394
443
|
def dynamic_key(name)
|
@@ -62,7 +62,7 @@ module MongoMapper
|
|
62
62
|
|
63
63
|
if @typecast
|
64
64
|
klass = typecast_class # Don't make this lookup on every call
|
65
|
-
type.from_mongo(value).map
|
65
|
+
type.from_mongo(value).map { |v| klass.from_mongo(v) }
|
66
66
|
else
|
67
67
|
type.from_mongo(value)
|
68
68
|
end
|
@@ -71,8 +71,11 @@ module MongoMapper
|
|
71
71
|
def set(value)
|
72
72
|
# Avoid tap here so we don't have to create a block binding.
|
73
73
|
values = type.to_mongo(value)
|
74
|
-
|
75
|
-
|
74
|
+
if @typecast
|
75
|
+
values.map { |v| typecast_class.to_mongo(v) }
|
76
|
+
else
|
77
|
+
values
|
78
|
+
end
|
76
79
|
end
|
77
80
|
|
78
81
|
def default_value
|
@@ -64,6 +64,18 @@ module MongoMapper
|
|
64
64
|
modifier_update('$pop', args)
|
65
65
|
end
|
66
66
|
|
67
|
+
def find_and_modify(args)
|
68
|
+
args[:query] = dealias_keys(args[:query]) if args.key? :query
|
69
|
+
args[:update] = dealias_keys(args[:update]) if args.key? :update
|
70
|
+
collection.find_and_modify(args)
|
71
|
+
end
|
72
|
+
|
73
|
+
def upsert(selector, updates, args = {})
|
74
|
+
criteria = dealias_keys(selector)
|
75
|
+
updates = dealias_keys(updates)
|
76
|
+
collection.update(criteria, updates, args)
|
77
|
+
end
|
78
|
+
|
67
79
|
private
|
68
80
|
def modifier_update(modifier, args)
|
69
81
|
criteria, updates, options = criteria_and_keys_from_args(args)
|
@@ -84,6 +96,7 @@ module MongoMapper
|
|
84
96
|
criteria = { :id => criteria }
|
85
97
|
end
|
86
98
|
upgrade_legacy_safe_usage!(options)
|
99
|
+
updates = dealias_keys updates
|
87
100
|
|
88
101
|
[criteria_hash(criteria).to_hash, updates, options]
|
89
102
|
end
|
@@ -29,6 +29,24 @@ module MongoMapper
|
|
29
29
|
self
|
30
30
|
end
|
31
31
|
|
32
|
+
def criteria_hash
|
33
|
+
@model.dealias_keys super
|
34
|
+
end
|
35
|
+
|
36
|
+
def options_hash
|
37
|
+
super.tap do |options|
|
38
|
+
case options[:fields]
|
39
|
+
when Hash
|
40
|
+
options[:fields] = @model.dealias options[:fields]
|
41
|
+
when Array
|
42
|
+
options[:fields] = options[:fields].map do |field|
|
43
|
+
key = keys[field.to_s]
|
44
|
+
key && key.abbr || field
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
32
50
|
def find!(*ids)
|
33
51
|
ids = Array(ids).flatten.uniq
|
34
52
|
raise DocumentNotFound, "Couldn't find without an ID" if ids.size == 0
|
@@ -40,7 +58,8 @@ module MongoMapper
|
|
40
58
|
end
|
41
59
|
end
|
42
60
|
|
43
|
-
|
61
|
+
protected
|
62
|
+
|
44
63
|
def method_missing(method, *args, &block)
|
45
64
|
return super unless model.respond_to?(method)
|
46
65
|
result = model.send(method, *args, &block)
|
@@ -10,11 +10,13 @@ module MongoMapper
|
|
10
10
|
|
11
11
|
module ClassMethods
|
12
12
|
def inherited(subclass)
|
13
|
-
key :_type, String unless key?(:_type)
|
14
13
|
super
|
15
14
|
if @collection_name == subclass.instance_variable_get("@collection_name")
|
15
|
+
key :_type, String unless key?(:_type)
|
16
16
|
subclass.single_collection_parent = self
|
17
17
|
subclass.instance_variable_set("@single_collection_inherited", true)
|
18
|
+
else
|
19
|
+
remove_key :_type
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -40,6 +42,7 @@ module MongoMapper
|
|
40
42
|
|
41
43
|
def set_collection_name(name)
|
42
44
|
if single_collection_inherited?
|
45
|
+
single_collection_parent.remove_key :_type
|
43
46
|
single_collection_parent = nil
|
44
47
|
@single_collection_inherited = false
|
45
48
|
end
|
@@ -3,7 +3,7 @@ module MongoMapper
|
|
3
3
|
module Touch
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
def touch(key = :updated_at)
|
6
|
+
def touch(key = :updated_at)
|
7
7
|
raise ArgumentError, "Invalid key named #{key}" unless self.key_names.include?(key.to_s)
|
8
8
|
if self.class.embeddable?
|
9
9
|
self.write_attribute(key, Time.now.utc)
|
@@ -29,11 +29,16 @@ module MongoMapper
|
|
29
29
|
|
30
30
|
class UniquenessValidator < ::ActiveModel::EachValidator
|
31
31
|
def initialize(options)
|
32
|
+
@klass = options[:class] #only provided in ActiveModel 4.1 and higher
|
32
33
|
super(options.reverse_merge(:case_sensitive => true))
|
33
34
|
end
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
if ::ActiveModel::VERSION::MAJOR < 4 ||
|
37
|
+
(::ActiveModel::VERSION::MAJOR == 4 && ::ActiveModel::VERSION::MINOR == 0)
|
38
|
+
|
39
|
+
def setup(klass)
|
40
|
+
@klass = klass
|
41
|
+
end
|
37
42
|
end
|
38
43
|
|
39
44
|
def validate_each(record, attribute, value)
|
data/lib/mongo_mapper/railtie.rb
CHANGED
@@ -2,12 +2,32 @@ require "mongo_mapper"
|
|
2
2
|
require "rails"
|
3
3
|
require "active_model/railtie"
|
4
4
|
|
5
|
+
# Need the action_dispatch railtie to have action_dispatch.rescu_responses initialized correctly
|
6
|
+
require "action_dispatch/railtie"
|
7
|
+
|
5
8
|
module MongoMapper
|
6
9
|
# = MongoMapper Railtie
|
7
10
|
class Railtie < Rails::Railtie
|
8
11
|
|
9
12
|
config.mongo_mapper = ActiveSupport::OrderedOptions.new
|
10
13
|
|
14
|
+
# Rescue responses similar to ActiveRecord.
|
15
|
+
# For rails 3.0 and 3.1
|
16
|
+
if Rails.version < "3.2"
|
17
|
+
ActionDispatch::ShowExceptions.rescue_responses['MongoMapper::DocumentNotFound'] = :not_found,
|
18
|
+
ActionDispatch::ShowExceptions.rescue_responses['MongoMapper::InvalidKey'] = :unprocessable_entity,
|
19
|
+
ActionDispatch::ShowExceptions.rescue_responses['MongoMapper::InvalidScheme'] = :unprocessable_entity,
|
20
|
+
ActionDispatch::ShowExceptions.rescue_responses['MongoMapper::NotSupported'] = :unprocessable_entity
|
21
|
+
else
|
22
|
+
# For rails 3.2 and 4.0
|
23
|
+
config.action_dispatch.rescue_responses.merge!(
|
24
|
+
'MongoMapper::DocumentNotFound' => :not_found,
|
25
|
+
'MongoMapper::InvalidKey' => :unprocessable_entity,
|
26
|
+
'MongoMapper::InvalidScheme' => :unprocessable_entity,
|
27
|
+
'MongoMapper::NotSupported' => :unprocessable_entity
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
11
31
|
rake_tasks do
|
12
32
|
load "mongo_mapper/railtie/database.rake"
|
13
33
|
end
|
@@ -2,7 +2,7 @@ namespace :db do
|
|
2
2
|
unless Rake::Task.task_defined?("db:drop")
|
3
3
|
desc 'Drops all the collections for the database for the current Rails.env'
|
4
4
|
task :drop => :environment do
|
5
|
-
MongoMapper.database.collections.select {|c| c.name !~
|
5
|
+
MongoMapper.database.collections.select {|c| c.name !~ /\Asystem\./ }.each(&:drop)
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
data/lib/mongo_mapper/version.rb
CHANGED
@@ -307,7 +307,7 @@ describe "EmbeddedDocument" do
|
|
307
307
|
|
308
308
|
it "should update attributes with symbol keys" do
|
309
309
|
person = @klass.create(:pets => [@pet_klass.new(:name => 'Rasmus', :flag => true)])
|
310
|
-
person.update_attributes!({pets
|
310
|
+
person.update_attributes!({:pets => [:name => "sparky", :flag => "false"]})
|
311
311
|
person.reload
|
312
312
|
person.pets.first.name.should == "sparky"
|
313
313
|
person.pets.first.flag.should be_false
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe "Indexing" do
|
4
4
|
before do
|
5
5
|
@document = Doc do
|
6
|
-
key :first_name, String
|
6
|
+
key :first_name, String, :alias => :fn
|
7
7
|
key :last_name, String
|
8
8
|
key :age, Integer
|
9
9
|
key :date, Date
|
@@ -11,22 +11,46 @@ describe "Indexing" do
|
|
11
11
|
end
|
12
12
|
after { drop_indexes(@document) }
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
context "against a known collection" do
|
15
|
+
before do
|
16
16
|
@document.stub(:collection).and_return(double(:name => :foo))
|
17
|
-
|
18
|
-
|
17
|
+
end
|
18
|
+
[:create_index, :ensure_index].each do |method|
|
19
|
+
it "should delegate #{method} to collection" do
|
20
|
+
@document.collection.should_receive(method).with(:arg, {})
|
21
|
+
@document.send(method, :arg)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should delegate drop_index to collection" do
|
26
|
+
@document.collection.should_receive(:drop_index).with(:arg)
|
27
|
+
@document.drop_index(:arg)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should delegate drop_indexes to collection" do
|
31
|
+
@document.collection.should_receive(:drop_indexes)
|
32
|
+
@document.drop_indexes
|
19
33
|
end
|
20
34
|
end
|
21
35
|
|
22
|
-
it "should allow creating index for
|
36
|
+
it "should allow creating index for an aliased key" do
|
23
37
|
@document.ensure_index :first_name
|
24
|
-
@document.should have_index('
|
38
|
+
@document.should have_index('fn_1')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should allow creating index for an aliased key without using the alias" do
|
42
|
+
@document.ensure_index :fn
|
43
|
+
@document.should have_index('fn_1')
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should allow creating index for an unaliased key" do
|
47
|
+
@document.ensure_index :last_name
|
48
|
+
@document.should have_index('last_name_1')
|
25
49
|
end
|
26
50
|
|
27
51
|
it "should allow creating unique index for a key" do
|
28
52
|
@document.ensure_index :first_name, :unique => true
|
29
|
-
@document.should have_index('
|
53
|
+
@document.should have_index('fn_1')
|
30
54
|
end
|
31
55
|
|
32
56
|
it "should allow creating index on multiple keys" do
|
@@ -37,7 +61,7 @@ describe "Indexing" do
|
|
37
61
|
# the values of the indexes to make sure the index creation was successful
|
38
62
|
@document.collection.index_information.detect do |index|
|
39
63
|
keys = index[0]
|
40
|
-
keys.include?('
|
64
|
+
keys.include?('fn_1') && keys.include?('last_name_-1')
|
41
65
|
end.should_not be_nil
|
42
66
|
end
|
43
67
|
|
@@ -24,6 +24,41 @@ describe "Keys" do
|
|
24
24
|
instance.get_foo.should == instance.foo
|
25
25
|
end
|
26
26
|
|
27
|
+
it "should return the value when set using send with the writer method" do
|
28
|
+
doc = Doc do
|
29
|
+
key :foo, String
|
30
|
+
end
|
31
|
+
|
32
|
+
instance = doc.new(:foo => 'bar')
|
33
|
+
instance.send("foo=", 'baz').should == 'baz'
|
34
|
+
instance.foo.should == 'baz'
|
35
|
+
end
|
36
|
+
|
37
|
+
context "when persisting an typecasted array" do
|
38
|
+
TypecastedKeyModel = Doc do
|
39
|
+
key :people, Array, :typecast => "Person"
|
40
|
+
end
|
41
|
+
|
42
|
+
Person = Struct.new(:name) do
|
43
|
+
def self.to_mongo(value)
|
44
|
+
value.name
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.from_mongo(value)
|
48
|
+
Person.new value
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should not mutate the model's state" do
|
53
|
+
person = Person.new "Bob"
|
54
|
+
doc = TypecastedKeyModel.new(:people => [person])
|
55
|
+
|
56
|
+
doc.save
|
57
|
+
|
58
|
+
doc.people.should == [person]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
27
62
|
it "should not bomb if a key is written before Keys#initialize gets to get called" do
|
28
63
|
doc = Class.new do
|
29
64
|
include MongoMapper::Document
|
@@ -159,8 +194,35 @@ describe "Keys" do
|
|
159
194
|
end
|
160
195
|
end
|
161
196
|
|
162
|
-
it "should permit querying via
|
163
|
-
AliasedKeyModel.where(AliasedKeyModel.abbr(:
|
197
|
+
it "should permit querying via direct field names" do
|
198
|
+
AliasedKeyModel.where(AliasedKeyModel.abbr(:foo) => "whee!").first.foo.should == "whee!"
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should permit querying via direct field names" do
|
202
|
+
AliasedKeyModel.where(:foo => "whee!").criteria_hash.keys.should == ["f"]
|
203
|
+
AliasedKeyModel.where(:foo => "whee!").first.foo.should == "whee!"
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should permit filtering via aliases" do
|
207
|
+
AliasedKeyModel.where(:foo => "whee!").fields(:foo).first.foo.should == "whee!"
|
208
|
+
end
|
209
|
+
|
210
|
+
it "should permit dealiasing of atomic operations" do
|
211
|
+
m = AliasedKeyModel.first
|
212
|
+
m.set(:foo => 1)
|
213
|
+
AliasedKeyModel.collection.find_one["f"].should == 1
|
214
|
+
AliasedKeyModel.collection.find_one["foo"].should be_nil
|
215
|
+
end
|
216
|
+
|
217
|
+
it "should permit dealiasing of update operations" do
|
218
|
+
m = AliasedKeyModel.first
|
219
|
+
m.update_attributes(:foo => 1)
|
220
|
+
AliasedKeyModel.collection.find_one["f"].should == 1
|
221
|
+
AliasedKeyModel.collection.find_one["foo"].should be_nil
|
222
|
+
end
|
223
|
+
|
224
|
+
it "should not break when unaliasing non-keys" do
|
225
|
+
AliasedKeyModel.where(:badkey => "whee!").criteria_hash.keys.should == [:badkey]
|
164
226
|
end
|
165
227
|
|
166
228
|
it "should serialize to JSON with full keys" do
|
data/spec/functional/sci_spec.rb
CHANGED
@@ -88,12 +88,47 @@ describe "Single collection inheritance (document)" do
|
|
88
88
|
DocDaughter.collection.name.should == DocParent.collection.name
|
89
89
|
end
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
context "if the subclass changes its collection" do
|
92
|
+
before do
|
93
|
+
class ::DocSCIOrphan < ::DocParent
|
94
|
+
set_collection_name "foobars"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
after do
|
99
|
+
Object.send :remove_const, 'DocSCIOrphan' if defined?(::DocSCIOrphan)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should negate SCI" do
|
103
|
+
DocSCIOrphan.collection.name.should == "foobars"
|
104
|
+
DocSCIOrphan.should_not be_single_collection_inherited
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should remove the _type key" do
|
108
|
+
DocParent.keys.should_not have_key "_type"
|
109
|
+
DocSCIOrphan.keys.should_not have_key "_type"
|
110
|
+
end
|
111
|
+
|
112
|
+
context "and then is subclassed again" do
|
113
|
+
before do
|
114
|
+
class ::DocSCIOrphanChild < ::DocSCIOrphan
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
after do
|
119
|
+
Object.send :remove_const, 'DocSCIOrphanChild' if defined?(::DocSCIOrphanChild)
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should reinstate SCI" do
|
123
|
+
DocSCIOrphan.should_not be_single_collection_inherited
|
124
|
+
DocSCIOrphanChild.should be_single_collection_inherited
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should have the _type key" do
|
128
|
+
DocSCIOrphan.keys.should have_key "_type"
|
129
|
+
DocSCIOrphanChild.keys.should have_key "_type"
|
130
|
+
end
|
94
131
|
end
|
95
|
-
klass.collection.name.should == "foobars"
|
96
|
-
klass.should_not be_single_collection_inherited
|
97
132
|
end
|
98
133
|
|
99
134
|
it "should know single_collection_parent" do
|
@@ -16,7 +16,7 @@ describe "Touch" do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
doc.reload
|
19
|
-
doc.updated_at.should_not == old_updated_at
|
19
|
+
doc.updated_at.should_not == old_updated_at
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -79,7 +79,7 @@ describe "Touch" do
|
|
79
79
|
|
80
80
|
@post.reload.updated_at.should_not == orig_updated_at
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
it "should when the child is updated" do
|
84
84
|
@comment.save
|
85
85
|
old_updated_at = @post.updated_at
|
@@ -88,7 +88,7 @@ describe "Touch" do
|
|
88
88
|
end
|
89
89
|
@post.reload.updated_at.should_not == old_updated_at
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
it "should when the child is touched" do
|
93
93
|
@comment.save
|
94
94
|
old_updated_at = @post.updated_at
|
@@ -117,9 +117,9 @@ describe "Touch" do
|
|
117
117
|
Timecop.freeze(Time.now + 1.day) do
|
118
118
|
comment.save
|
119
119
|
end
|
120
|
-
|
120
|
+
|
121
121
|
post.reload.updated_at.should == post.created_at
|
122
122
|
end
|
123
123
|
end
|
124
124
|
end
|
125
|
-
end
|
125
|
+
end
|
data/spec/unit/inspect_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe "Inspect" do
|
|
15
15
|
it "should print out non-nil attributes in alpha sorted order" do
|
16
16
|
@doc.inspect.should =~ /_id:.*, age: 29, name: "John"/
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
it "should print out all attributes when (optional) include_super argument is true" do
|
20
20
|
@doc.inspect(true).should =~ /_id:.*, age: 29, email: nil, name: "John"/
|
21
21
|
end
|
@@ -23,7 +23,7 @@ describe "Inspect" do
|
|
23
23
|
it "should include class name" do
|
24
24
|
@doc.inspect.should =~ /^#<User/
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
it "should include embedded documents" do
|
28
28
|
klass = Doc()
|
29
29
|
pets = EDoc()
|
@@ -33,7 +33,7 @@ describe "Inspect" do
|
|
33
33
|
doc = klass.new(:pets => [{:name => "Kitten"}])
|
34
34
|
doc.inspect.should =~ /_id:.*, pets: \[.*_id.*, name: "Kitten".*\]/
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
it "should include embedded document" do
|
38
38
|
klass = Doc()
|
39
39
|
pet = EDoc()
|
@@ -44,4 +44,4 @@ describe "Inspect" do
|
|
44
44
|
doc.inspect.should =~ /_id:.*, pet: .*_id.*, name: "Kitten".*/
|
45
45
|
end
|
46
46
|
end
|
47
|
-
end
|
47
|
+
end
|
@@ -12,10 +12,8 @@ describe MongoMapper::Generators::ModelGenerator do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'help shows MongoMapper options' do
|
15
|
-
|
16
|
-
|
17
|
-
assert_match(/rails generate mongo_mapper:model/, content)
|
18
|
-
end
|
15
|
+
content = run_generator ['--help']
|
16
|
+
assert_match(/rails generate mongo_mapper:model/, content)
|
19
17
|
end
|
20
18
|
|
21
19
|
it 'model are properly created' do
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_mapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.0
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-05-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
15
|
-
|
15
|
+
version_requirements: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.0.0
|
20
|
-
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
23
21
|
requirements:
|
24
22
|
- - '>='
|
25
23
|
- !ruby/object:Gem::Version
|
26
24
|
version: 3.0.0
|
25
|
+
prerelease: false
|
26
|
+
type: :runtime
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
|
-
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.0'
|
34
|
-
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
37
35
|
requirements:
|
38
36
|
- - '>='
|
39
37
|
- !ruby/object:Gem::Version
|
40
38
|
version: '3.0'
|
39
|
+
prerelease: false
|
40
|
+
type: :runtime
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: plucky
|
43
|
-
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 0.6.5
|
48
|
-
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
51
49
|
requirements:
|
52
50
|
- - ~>
|
53
51
|
- !ruby/object:Gem::Version
|
54
52
|
version: 0.6.5
|
53
|
+
prerelease: false
|
54
|
+
type: :runtime
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mongo
|
57
|
-
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.8'
|
62
|
-
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
65
63
|
requirements:
|
66
64
|
- - ~>
|
67
65
|
- !ruby/object:Gem::Version
|
68
66
|
version: '1.8'
|
67
|
+
prerelease: false
|
68
|
+
type: :runtime
|
69
69
|
description: MongoMapper is a Object-Document Mapper for Ruby and Rails
|
70
70
|
email:
|
71
71
|
- nunemaker@gmail.com
|
@@ -74,189 +74,191 @@ executables:
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- LICENSE
|
78
|
+
- README.rdoc
|
79
|
+
- UPGRADES
|
77
80
|
- bin/mmconsole
|
78
|
-
- examples/
|
81
|
+
- examples/attr_accessible.rb
|
82
|
+
- examples/attr_protected.rb
|
83
|
+
- examples/cache_key.rb
|
79
84
|
- examples/custom_types.rb
|
80
|
-
- examples/
|
85
|
+
- examples/identity_map.rb
|
86
|
+
- examples/identity_map/automatic.rb
|
81
87
|
- examples/keys.rb
|
82
|
-
- examples/
|
83
|
-
- examples/scopes.rb
|
88
|
+
- examples/modifiers/set.rb
|
84
89
|
- examples/plugins.rb
|
85
|
-
- examples/attr_protected.rb
|
86
90
|
- examples/querying.rb
|
87
|
-
- examples/identity_map/automatic.rb
|
88
|
-
- examples/validating/embedded_docs.rb
|
89
91
|
- examples/safe.rb
|
90
|
-
- examples/
|
92
|
+
- examples/scopes.rb
|
93
|
+
- examples/validating/embedded_docs.rb
|
91
94
|
- lib/mongo_mapper.rb
|
92
|
-
- lib/rails/generators/mongo_mapper/model/model_generator.rb
|
93
|
-
- lib/rails/generators/mongo_mapper/model/templates/model.rb
|
94
|
-
- lib/rails/generators/mongo_mapper/config/config_generator.rb
|
95
|
-
- lib/rails/generators/mongo_mapper/config/templates/mongo.yml
|
96
|
-
- lib/mongo_mapper/railtie.rb
|
97
|
-
- lib/mongo_mapper/embedded_document.rb
|
98
95
|
- lib/mongo_mapper/connection.rb
|
99
|
-
- lib/mongo_mapper/
|
100
|
-
- lib/mongo_mapper/
|
101
|
-
- lib/mongo_mapper/
|
102
|
-
- lib/mongo_mapper/
|
103
|
-
- lib/mongo_mapper/
|
104
|
-
- lib/mongo_mapper/
|
105
|
-
- lib/mongo_mapper/
|
106
|
-
- lib/mongo_mapper/
|
107
|
-
- lib/mongo_mapper/
|
108
|
-
- lib/mongo_mapper/
|
109
|
-
- lib/mongo_mapper/
|
96
|
+
- lib/mongo_mapper/connections/10gen.rb
|
97
|
+
- lib/mongo_mapper/connections/moped.rb
|
98
|
+
- lib/mongo_mapper/document.rb
|
99
|
+
- lib/mongo_mapper/embedded_document.rb
|
100
|
+
- lib/mongo_mapper/exceptions.rb
|
101
|
+
- lib/mongo_mapper/extensions/array.rb
|
102
|
+
- lib/mongo_mapper/extensions/binary.rb
|
103
|
+
- lib/mongo_mapper/extensions/boolean.rb
|
104
|
+
- lib/mongo_mapper/extensions/date.rb
|
105
|
+
- lib/mongo_mapper/extensions/float.rb
|
106
|
+
- lib/mongo_mapper/extensions/hash.rb
|
107
|
+
- lib/mongo_mapper/extensions/integer.rb
|
108
|
+
- lib/mongo_mapper/extensions/kernel.rb
|
109
|
+
- lib/mongo_mapper/extensions/nil_class.rb
|
110
|
+
- lib/mongo_mapper/extensions/object.rb
|
111
|
+
- lib/mongo_mapper/extensions/object_id.rb
|
112
|
+
- lib/mongo_mapper/extensions/ordered_hash.rb
|
113
|
+
- lib/mongo_mapper/extensions/set.rb
|
114
|
+
- lib/mongo_mapper/extensions/string.rb
|
115
|
+
- lib/mongo_mapper/extensions/time.rb
|
116
|
+
- lib/mongo_mapper/locale/en.yml
|
117
|
+
- lib/mongo_mapper/middleware/identity_map.rb
|
118
|
+
- lib/mongo_mapper/plugins.rb
|
119
|
+
- lib/mongo_mapper/plugins/accessible.rb
|
120
|
+
- lib/mongo_mapper/plugins/active_model.rb
|
121
|
+
- lib/mongo_mapper/plugins/associations.rb
|
122
|
+
- lib/mongo_mapper/plugins/associations/base.rb
|
123
|
+
- lib/mongo_mapper/plugins/associations/belongs_to_association.rb
|
110
124
|
- lib/mongo_mapper/plugins/associations/belongs_to_polymorphic_proxy.rb
|
111
|
-
- lib/mongo_mapper/plugins/associations/
|
112
|
-
- lib/mongo_mapper/plugins/associations/
|
113
|
-
- lib/mongo_mapper/plugins/associations/many_embedded_polymorphic_proxy.rb
|
114
|
-
- lib/mongo_mapper/plugins/associations/one_proxy.rb
|
115
|
-
- lib/mongo_mapper/plugins/associations/one_as_proxy.rb
|
116
|
-
- lib/mongo_mapper/plugins/associations/many_documents_proxy.rb
|
117
|
-
- lib/mongo_mapper/plugins/associations/one_embedded_proxy.rb
|
125
|
+
- lib/mongo_mapper/plugins/associations/belongs_to_proxy.rb
|
126
|
+
- lib/mongo_mapper/plugins/associations/collection.rb
|
118
127
|
- lib/mongo_mapper/plugins/associations/embedded_collection.rb
|
119
|
-
- lib/mongo_mapper/plugins/associations/base.rb
|
120
128
|
- lib/mongo_mapper/plugins/associations/in_array_proxy.rb
|
121
|
-
- lib/mongo_mapper/plugins/associations/
|
122
|
-
- lib/mongo_mapper/plugins/associations/many_polymorphic_proxy.rb
|
123
|
-
- lib/mongo_mapper/plugins/associations/collection.rb
|
124
|
-
- lib/mongo_mapper/plugins/associations/belongs_to_association.rb
|
129
|
+
- lib/mongo_mapper/plugins/associations/many_association.rb
|
125
130
|
- lib/mongo_mapper/plugins/associations/many_documents_as_proxy.rb
|
126
|
-
- lib/mongo_mapper/plugins/associations/
|
131
|
+
- lib/mongo_mapper/plugins/associations/many_documents_proxy.rb
|
132
|
+
- lib/mongo_mapper/plugins/associations/many_embedded_polymorphic_proxy.rb
|
133
|
+
- lib/mongo_mapper/plugins/associations/many_embedded_proxy.rb
|
134
|
+
- lib/mongo_mapper/plugins/associations/many_polymorphic_proxy.rb
|
135
|
+
- lib/mongo_mapper/plugins/associations/one_as_proxy.rb
|
127
136
|
- lib/mongo_mapper/plugins/associations/one_association.rb
|
128
137
|
- lib/mongo_mapper/plugins/associations/one_embedded_polymorphic_proxy.rb
|
138
|
+
- lib/mongo_mapper/plugins/associations/one_embedded_proxy.rb
|
139
|
+
- lib/mongo_mapper/plugins/associations/one_proxy.rb
|
140
|
+
- lib/mongo_mapper/plugins/associations/proxy.rb
|
141
|
+
- lib/mongo_mapper/plugins/associations/single_association.rb
|
142
|
+
- lib/mongo_mapper/plugins/caching.rb
|
143
|
+
- lib/mongo_mapper/plugins/callbacks.rb
|
144
|
+
- lib/mongo_mapper/plugins/clone.rb
|
145
|
+
- lib/mongo_mapper/plugins/dirty.rb
|
146
|
+
- lib/mongo_mapper/plugins/document.rb
|
147
|
+
- lib/mongo_mapper/plugins/dumpable.rb
|
129
148
|
- lib/mongo_mapper/plugins/dynamic_querying.rb
|
149
|
+
- lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb
|
150
|
+
- lib/mongo_mapper/plugins/embedded_callbacks.rb
|
151
|
+
- lib/mongo_mapper/plugins/embedded_document.rb
|
130
152
|
- lib/mongo_mapper/plugins/equality.rb
|
153
|
+
- lib/mongo_mapper/plugins/identity_map.rb
|
131
154
|
- lib/mongo_mapper/plugins/indexes.rb
|
132
|
-
- lib/mongo_mapper/plugins/
|
133
|
-
- lib/mongo_mapper/plugins/
|
155
|
+
- lib/mongo_mapper/plugins/inspect.rb
|
156
|
+
- lib/mongo_mapper/plugins/keys.rb
|
157
|
+
- lib/mongo_mapper/plugins/keys/key.rb
|
134
158
|
- lib/mongo_mapper/plugins/logger.rb
|
159
|
+
- lib/mongo_mapper/plugins/modifiers.rb
|
160
|
+
- lib/mongo_mapper/plugins/pagination.rb
|
161
|
+
- lib/mongo_mapper/plugins/persistence.rb
|
162
|
+
- lib/mongo_mapper/plugins/protected.rb
|
163
|
+
- lib/mongo_mapper/plugins/querying.rb
|
135
164
|
- lib/mongo_mapper/plugins/querying/decorated_plucky_query.rb
|
136
|
-
- lib/mongo_mapper/plugins/
|
137
|
-
- lib/mongo_mapper/plugins/accessible.rb
|
138
|
-
- lib/mongo_mapper/plugins/sci.rb
|
139
|
-
- lib/mongo_mapper/plugins/dynamic_querying/dynamic_finder.rb
|
140
|
-
- lib/mongo_mapper/plugins/clone.rb
|
141
|
-
- lib/mongo_mapper/plugins/embedded_callbacks.rb
|
165
|
+
- lib/mongo_mapper/plugins/rails.rb
|
142
166
|
- lib/mongo_mapper/plugins/rails/active_record_association_adapter.rb
|
143
|
-
- lib/mongo_mapper/plugins/keys/key.rb
|
144
|
-
- lib/mongo_mapper/plugins/querying.rb
|
145
|
-
- lib/mongo_mapper/plugins/serialization.rb
|
146
|
-
- lib/mongo_mapper/plugins/dirty.rb
|
147
|
-
- lib/mongo_mapper/plugins/associations.rb
|
148
|
-
- lib/mongo_mapper/plugins/callbacks.rb
|
149
|
-
- lib/mongo_mapper/plugins/pagination.rb
|
150
|
-
- lib/mongo_mapper/plugins/document.rb
|
151
|
-
- lib/mongo_mapper/plugins/validations.rb
|
152
167
|
- lib/mongo_mapper/plugins/safe.rb
|
168
|
+
- lib/mongo_mapper/plugins/sci.rb
|
169
|
+
- lib/mongo_mapper/plugins/scopes.rb
|
170
|
+
- lib/mongo_mapper/plugins/serialization.rb
|
153
171
|
- lib/mongo_mapper/plugins/timestamps.rb
|
154
|
-
- lib/mongo_mapper/plugins/
|
155
|
-
- lib/mongo_mapper/plugins/
|
156
|
-
- lib/mongo_mapper/
|
157
|
-
- lib/mongo_mapper/
|
158
|
-
- lib/mongo_mapper/extensions/integer.rb
|
159
|
-
- lib/mongo_mapper/extensions/time.rb
|
160
|
-
- lib/mongo_mapper/extensions/hash.rb
|
161
|
-
- lib/mongo_mapper/extensions/boolean.rb
|
162
|
-
- lib/mongo_mapper/extensions/array.rb
|
163
|
-
- lib/mongo_mapper/extensions/nil_class.rb
|
164
|
-
- lib/mongo_mapper/extensions/ordered_hash.rb
|
165
|
-
- lib/mongo_mapper/extensions/kernel.rb
|
166
|
-
- lib/mongo_mapper/extensions/string.rb
|
167
|
-
- lib/mongo_mapper/extensions/set.rb
|
168
|
-
- lib/mongo_mapper/extensions/float.rb
|
169
|
-
- lib/mongo_mapper/extensions/binary.rb
|
170
|
-
- lib/mongo_mapper/extensions/date.rb
|
171
|
-
- lib/mongo_mapper/version.rb
|
172
|
-
- lib/mongo_mapper/plugins.rb
|
173
|
-
- lib/mongo_mapper/middleware/identity_map.rb
|
172
|
+
- lib/mongo_mapper/plugins/touch.rb
|
173
|
+
- lib/mongo_mapper/plugins/userstamps.rb
|
174
|
+
- lib/mongo_mapper/plugins/validations.rb
|
175
|
+
- lib/mongo_mapper/railtie.rb
|
174
176
|
- lib/mongo_mapper/railtie/database.rake
|
175
|
-
- lib/mongo_mapper/exceptions.rb
|
176
|
-
- lib/mongo_mapper/locale/en.yml
|
177
|
-
- lib/mongo_mapper/document.rb
|
178
177
|
- lib/mongo_mapper/translation.rb
|
179
|
-
-
|
180
|
-
-
|
181
|
-
-
|
182
|
-
-
|
183
|
-
-
|
184
|
-
-
|
185
|
-
- spec/functional/
|
178
|
+
- lib/mongo_mapper/utils.rb
|
179
|
+
- lib/mongo_mapper/version.rb
|
180
|
+
- lib/rails/generators/mongo_mapper/config/config_generator.rb
|
181
|
+
- lib/rails/generators/mongo_mapper/config/templates/mongo.yml
|
182
|
+
- lib/rails/generators/mongo_mapper/model/model_generator.rb
|
183
|
+
- lib/rails/generators/mongo_mapper/model/templates/model.rb
|
184
|
+
- spec/functional/accessible_spec.rb
|
185
|
+
- spec/functional/associations/belongs_to_polymorphic_proxy_spec.rb
|
186
186
|
- spec/functional/associations/belongs_to_proxy_spec.rb
|
187
|
+
- spec/functional/associations/in_array_proxy_spec.rb
|
187
188
|
- spec/functional/associations/many_documents_as_proxy_spec.rb
|
188
|
-
- spec/functional/associations/many_embedded_proxy_spec.rb
|
189
189
|
- spec/functional/associations/many_documents_proxy_spec.rb
|
190
|
-
- spec/functional/associations/one_proxy_spec.rb
|
191
|
-
- spec/functional/associations/one_embedded_proxy_spec.rb
|
192
190
|
- spec/functional/associations/many_embedded_polymorphic_proxy_spec.rb
|
193
|
-
- spec/functional/associations/
|
191
|
+
- spec/functional/associations/many_embedded_proxy_spec.rb
|
192
|
+
- spec/functional/associations/many_polymorphic_proxy_spec.rb
|
193
|
+
- spec/functional/associations/one_as_proxy_spec.rb
|
194
194
|
- spec/functional/associations/one_embedded_polymorphic_proxy_spec.rb
|
195
|
-
- spec/functional/
|
196
|
-
- spec/functional/
|
197
|
-
- spec/functional/
|
195
|
+
- spec/functional/associations/one_embedded_proxy_spec.rb
|
196
|
+
- spec/functional/associations/one_proxy_spec.rb
|
197
|
+
- spec/functional/associations_spec.rb
|
198
|
+
- spec/functional/binary_spec.rb
|
199
|
+
- spec/functional/caching_spec.rb
|
200
|
+
- spec/functional/callbacks_spec.rb
|
201
|
+
- spec/functional/dirty_spec.rb
|
202
|
+
- spec/functional/document_spec.rb
|
198
203
|
- spec/functional/dumpable_spec.rb
|
199
|
-
- spec/functional/protected_spec.rb
|
200
|
-
- spec/functional/modifiers_spec.rb
|
201
|
-
- spec/functional/pagination_spec.rb
|
202
|
-
- spec/functional/validations_spec.rb
|
203
204
|
- spec/functional/dynamic_querying_spec.rb
|
205
|
+
- spec/functional/embedded_document_spec.rb
|
204
206
|
- spec/functional/equality_spec.rb
|
205
|
-
- spec/functional/callbacks_spec.rb
|
206
207
|
- spec/functional/extensions_spec.rb
|
208
|
+
- spec/functional/identity_map_spec.rb
|
209
|
+
- spec/functional/indexes_spec.rb
|
210
|
+
- spec/functional/keys_spec.rb
|
211
|
+
- spec/functional/logger_spec.rb
|
212
|
+
- spec/functional/modifiers_spec.rb
|
213
|
+
- spec/functional/pagination_spec.rb
|
214
|
+
- spec/functional/protected_spec.rb
|
207
215
|
- spec/functional/querying_spec.rb
|
216
|
+
- spec/functional/rails_spec.rb
|
217
|
+
- spec/functional/safe_spec.rb
|
218
|
+
- spec/functional/sci_spec.rb
|
208
219
|
- spec/functional/scopes_spec.rb
|
209
|
-
- spec/functional/logger_spec.rb
|
210
|
-
- spec/functional/document_spec.rb
|
211
220
|
- spec/functional/timestamps_spec.rb
|
212
|
-
- spec/functional/
|
213
|
-
- spec/functional/
|
214
|
-
- spec/functional/
|
215
|
-
- spec/
|
216
|
-
- spec/
|
217
|
-
- spec/
|
218
|
-
- spec/functional/safe_spec.rb
|
219
|
-
- spec/unit/rails_compatibility_spec.rb
|
220
|
-
- spec/unit/rails_spec.rb
|
221
|
-
- spec/unit/key_spec.rb
|
222
|
-
- spec/unit/clone_spec.rb
|
223
|
-
- spec/unit/associations/many_association_spec.rb
|
224
|
-
- spec/unit/associations/one_association_spec.rb
|
221
|
+
- spec/functional/touch_spec.rb
|
222
|
+
- spec/functional/userstamps_spec.rb
|
223
|
+
- spec/functional/validations_spec.rb
|
224
|
+
- spec/spec_helper.rb
|
225
|
+
- spec/support/matchers.rb
|
226
|
+
- spec/support/models.rb
|
225
227
|
- spec/unit/associations/base_spec.rb
|
226
228
|
- spec/unit/associations/belongs_to_association_spec.rb
|
229
|
+
- spec/unit/associations/many_association_spec.rb
|
230
|
+
- spec/unit/associations/one_association_spec.rb
|
227
231
|
- spec/unit/associations/proxy_spec.rb
|
228
|
-
- spec/unit/
|
229
|
-
- spec/unit/serialization_spec.rb
|
230
|
-
- spec/unit/plugins_spec.rb
|
231
|
-
- spec/unit/pagination_spec.rb
|
232
|
-
- spec/unit/validations_spec.rb
|
233
|
-
- spec/unit/equality_spec.rb
|
232
|
+
- spec/unit/clone_spec.rb
|
234
233
|
- spec/unit/config_generator_spec.rb
|
235
|
-
- spec/unit/extensions_spec.rb
|
236
|
-
- spec/unit/rails_reflect_on_association_spec.rb
|
237
|
-
- spec/unit/exceptions_spec.rb
|
238
|
-
- spec/unit/identity_map_middleware_spec.rb
|
239
|
-
- spec/unit/translation_spec.rb
|
240
|
-
- spec/unit/time_zones_spec.rb
|
241
234
|
- spec/unit/document_spec.rb
|
242
|
-
- spec/unit/
|
235
|
+
- spec/unit/dynamic_finder_spec.rb
|
243
236
|
- spec/unit/embedded_document_spec.rb
|
237
|
+
- spec/unit/equality_spec.rb
|
238
|
+
- spec/unit/exceptions_spec.rb
|
239
|
+
- spec/unit/extensions_spec.rb
|
240
|
+
- spec/unit/identity_map_middleware_spec.rb
|
244
241
|
- spec/unit/inspect_spec.rb
|
242
|
+
- spec/unit/key_spec.rb
|
245
243
|
- spec/unit/keys_spec.rb
|
244
|
+
- spec/unit/model_generator_spec.rb
|
245
|
+
- spec/unit/mongo_mapper_spec.rb
|
246
|
+
- spec/unit/pagination_spec.rb
|
247
|
+
- spec/unit/plugins_spec.rb
|
248
|
+
- spec/unit/rails_compatibility_spec.rb
|
249
|
+
- spec/unit/rails_reflect_on_association_spec.rb
|
250
|
+
- spec/unit/rails_spec.rb
|
251
|
+
- spec/unit/serialization_spec.rb
|
246
252
|
- spec/unit/serializers/json_serializer_spec.rb
|
247
253
|
- spec/unit/serializers/xml_serializer_spec.rb
|
248
|
-
- spec/unit/
|
249
|
-
- spec/
|
250
|
-
- spec/
|
251
|
-
- spec/support/models.rb
|
252
|
-
- LICENSE
|
253
|
-
- UPGRADES
|
254
|
-
- README.rdoc
|
254
|
+
- spec/unit/time_zones_spec.rb
|
255
|
+
- spec/unit/translation_spec.rb
|
256
|
+
- spec/unit/validations_spec.rb
|
255
257
|
homepage: http://mongomapper.com
|
256
258
|
licenses:
|
257
259
|
- MIT
|
258
260
|
metadata: {}
|
259
|
-
post_install_message:
|
261
|
+
post_install_message:
|
260
262
|
rdoc_options: []
|
261
263
|
require_paths:
|
262
264
|
- lib
|
@@ -267,13 +269,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
267
269
|
version: '0'
|
268
270
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
269
271
|
requirements:
|
270
|
-
- - '
|
272
|
+
- - '>='
|
271
273
|
- !ruby/object:Gem::Version
|
272
|
-
version:
|
274
|
+
version: '0'
|
273
275
|
requirements: []
|
274
|
-
rubyforge_project:
|
275
|
-
rubygems_version: 2.
|
276
|
-
signing_key:
|
276
|
+
rubyforge_project:
|
277
|
+
rubygems_version: 2.2.2
|
278
|
+
signing_key:
|
277
279
|
specification_version: 4
|
278
280
|
summary: A Ruby Object Mapper for Mongo
|
279
281
|
test_files: []
|