mongoid 2.0.0.beta.11 → 2.0.0.beta.12
Sign up to get free protection for your applications and to get access to all the features.
data/lib/mongoid/associations.rb
CHANGED
@@ -245,6 +245,19 @@ module Mongoid # :nodoc:
|
|
245
245
|
association = associations[name.to_s]
|
246
246
|
end
|
247
247
|
|
248
|
+
# Returns all association meta data for the provided type.
|
249
|
+
#
|
250
|
+
# Options:
|
251
|
+
#
|
252
|
+
# macro: The association macro.
|
253
|
+
#
|
254
|
+
# Example:
|
255
|
+
#
|
256
|
+
# <tt>Person.reflect_on_all_associations(:embeds_many)</tt>
|
257
|
+
def reflect_on_all_associations(macro)
|
258
|
+
associations.values.select { |meta| meta.macro == macro }
|
259
|
+
end
|
260
|
+
|
248
261
|
protected
|
249
262
|
# Adds the association to the associations hash with the type as the key,
|
250
263
|
# then adds the accessors for the association. The defined setters and
|
@@ -123,7 +123,7 @@ module Mongoid #:nodoc:
|
|
123
123
|
# Array or single Document.
|
124
124
|
def find(param)
|
125
125
|
return @target if param == :all
|
126
|
-
|
126
|
+
criteria.id(param).first
|
127
127
|
end
|
128
128
|
|
129
129
|
# Creates the new association by finding the attributes in
|
@@ -3,7 +3,7 @@ namespace :db do
|
|
3
3
|
if not Rake::Task.task_defined?("db:drop")
|
4
4
|
desc 'Drops all the collections for the database for the current Rails.env'
|
5
5
|
task :drop => :environment do
|
6
|
-
Mongoid.master.collections.
|
6
|
+
Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
data/lib/mongoid/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 62196475
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version: 2.0.0.beta.
|
11
|
+
- 12
|
12
|
+
version: 2.0.0.beta.12
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Durran Jordan
|