Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 77 lines (67 sloc) 2.778 kb
aeff19d6 » durran
2009-09-20 Updating doco and gems for 1.9.1
1 # Copyright (c) 2009 Durran Jordan
2 #
3 # Permission is hereby granted, free of charge, to any person obtaining
4 # a copy of this software and associated documentation files (the
5 # "Software"), to deal in the Software without restriction, including
6 # without limitation the rights to use, copy, modify, merge, publish,
7 # distribute, sublicense, and/or sell copies of the Software, and to
8 # permit persons to whom the Software is furnished to do so, subject to
9 # the following conditions:
10 #
11 # The above copyright notice and this permission notice shall be
12 # included in all copies or substantial portions of the Software.
13 #
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3d8771a7 » durran
2009-08-26 Adding Mogoloid Module and ability to get and set connections
21 require "rubygems"
22
7898361b » durran
2009-09-19 Adding validation support via the Jay Fields' Validatable gem
23 gem "activesupport", "2.3.4"
24 gem "mongodb-mongo", "0.14.1"
84beee5e » durran
2009-09-23 Switching to durran-validatable
25 gem "durran-validatable", "1.7.5"
3d8771a7 » durran
2009-08-26 Adding Mogoloid Module and ability to get and set connections
26
7898361b » durran
2009-09-19 Adding validation support via the Jay Fields' Validatable gem
27 require "validatable"
ac047930 » durran
2009-09-22 callbacks via activesupport
28 require "active_support/callbacks"
29 require "active_support/core_ext"
4c08ed00 » durran
2009-09-07 Big one: refactoring all associations and removing the old factories
30 require "delegate"
3d8771a7 » durran
2009-08-26 Adding Mogoloid Module and ability to get and set connections
31 require "mongo"
0d366728 » durran
2009-09-16 Renaming to something fake and less offensive
32 require "mongoid/associations/association_factory"
33 require "mongoid/associations/belongs_to_association"
34 require "mongoid/associations/has_many_association"
35 require "mongoid/associations/has_one_association"
5c937c15 » durran
2009-09-19 Associations can now be set directly
36 require "mongoid/extensions/array/conversions"
37 require "mongoid/extensions/object/conversions"
38 require "mongoid/extensions"
0d366728 » durran
2009-09-16 Renaming to something fake and less offensive
39 require "mongoid/document"
40 require "mongoid/paginator"
3d8771a7 » durran
2009-08-26 Adding Mogoloid Module and ability to get and set connections
41
0d366728 » durran
2009-09-16 Renaming to something fake and less offensive
42 module Mongoid
6e8b72af » durran
2009-08-28 Iniitial document modeling and specs
43
e500a91d » durran
2009-09-05 Moving exceptions to mongoloid root
44 # Thrown when the database connection has not been set up.
6e8b72af » durran
2009-08-28 Iniitial document modeling and specs
45 class NoConnectionError < RuntimeError
3d8771a7 » durran
2009-08-26 Adding Mogoloid Module and ability to get and set connections
46 end
6e8b72af » durran
2009-08-28 Iniitial document modeling and specs
47
e500a91d » durran
2009-09-05 Moving exceptions to mongoloid root
48 # Thrown when :document_class is not provided in the attributes
49 # hash when creating a new Document
50 class ClassNotProvidedError < RuntimeError
51 end
52
27bb396e » durran
2009-09-19 Updating readme
53 # Thrown when an association is defined on the class, but the
e500a91d » durran
2009-09-05 Moving exceptions to mongoloid root
54 # attribute in the hash is not an Array or Hash.
55 class TypeMismatchError < RuntimeError
56 end
57
58 # Thrown when an association is defined that is not valid. Must
59 # be belongs_to, has_many, has_one
60 class InvalidAssociationError < RuntimeError
61 end
62
b9948c48 » durran
2009-08-29 Adding simple find that takes a selector
63 # Connect to the database name supplied. This should be run
64 # for initial setup, potentially in a rails initializer.
6e8b72af » durran
2009-08-28 Iniitial document modeling and specs
65 def self.connect_to(name)
eb4b1821 » durran
2009-09-19 Removing XGen namespace
66 @@connection ||= Mongo::Connection.new
6e8b72af » durran
2009-08-28 Iniitial document modeling and specs
67 @@database ||= @@connection.db(name)
3d8771a7 » durran
2009-08-26 Adding Mogoloid Module and ability to get and set connections
68 end
6e8b72af » durran
2009-08-28 Iniitial document modeling and specs
69
0d366728 » durran
2009-09-16 Renaming to something fake and less offensive
70 # Get the MongoDB database. If initialization via Mongoid.connect_to()
b9948c48 » durran
2009-08-29 Adding simple find that takes a selector
71 # has not happened, an exception will occur.
6e8b72af » durran
2009-08-28 Iniitial document modeling and specs
72 def self.database
73 raise NoConnectionError unless @@database
74 @@database
75 end
76
77 end
Something went wrong with that request. Please try again.