mongoid 2.0.0.beta.11 → 2.0.0.beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
- return detect { |document| document.id == param }
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.each{|col| col.drop unless col.name == 'system.users' || col.name == "system.indexes" }
6
+ Mongoid.master.collections.select {|c| c.name !~ /system/ }.each(&:drop)
7
7
  end
8
8
  end
9
9
 
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid #:nodoc
3
- VERSION = "2.0.0.beta.11"
3
+ VERSION = "2.0.0.beta.12"
4
4
  end
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: 62196469
4
+ hash: 62196475
5
5
  prerelease: true
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
9
  - 0
10
10
  - beta
11
- - 11
12
- version: 2.0.0.beta.11
11
+ - 12
12
+ version: 2.0.0.beta.12
13
13
  platform: ruby
14
14
  authors:
15
15
  - Durran Jordan