active_record.rb 3.9 KB
Newer Older
D
Initial  
David Heinemeier Hansson 已提交
1
#--
2
# Copyright (c) 2004-2012 David Heinemeier Hansson
D
Initial  
David Heinemeier Hansson 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++

24
require 'active_support'
X
Xavier Noria 已提交
25
require 'active_support/i18n'
26
require 'active_model'
27
require 'arel'
28
require 'active_record_deprecated_finders'
J
Jeremy Kemper 已提交
29

30 31
require 'active_record/version'

J
Joshua Peek 已提交
32
module ActiveRecord
C
Carlhuda 已提交
33
  extend ActiveSupport::Autoload
D
Initial  
David Heinemeier Hansson 已提交
34

J
Joshua Peek 已提交
35
  eager_autoload do
36 37
    autoload :ActiveRecordError, 'active_record/errors'
    autoload :ConnectionNotEstablished, 'active_record/errors'
38
    autoload :ConnectionAdapters, 'active_record/connection_adapters/abstract_adapter'
39

J
Joshua Peek 已提交
40 41 42
    autoload :Aggregations
    autoload :Associations
    autoload :AttributeMethods
43
    autoload :AttributeAssignment
J
Joshua Peek 已提交
44
    autoload :AutosaveAssociation
45

J
Joshua Peek 已提交
46
    autoload :Relation
47
    autoload :NullRelation
48 49 50 51

    autoload_under 'relation' do
      autoload :QueryMethods
      autoload :FinderMethods
52
      autoload :Calculations
53
      autoload :PredicateBuilder
54
      autoload :SpawnMethods
P
Pratik Naik 已提交
55
      autoload :Batches
56
      autoload :Explain
57
      autoload :Delegation
58 59
    end

J
Joshua Peek 已提交
60 61
    autoload :Base
    autoload :Callbacks
62
    autoload :Core
63
    autoload :CounterCache
64
    autoload :ConnectionHandling
65 66 67 68
    autoload :DynamicMatchers
    autoload :Explain
    autoload :Inheritance
    autoload :Integration
J
Joshua Peek 已提交
69 70
    autoload :Migration
    autoload :Migrator, 'active_record/migration'
71
    autoload :Model
72
    autoload :ModelSchema
J
Joshua Peek 已提交
73 74
    autoload :NestedAttributes
    autoload :Observer
75
    autoload :Persistence
J
Joshua Peek 已提交
76
    autoload :QueryCache
77 78
    autoload :Querying
    autoload :ReadonlyAttributes
J
Joshua Peek 已提交
79
    autoload :Reflection
80
    autoload :Result
81
    autoload :Sanitization
J
Joshua Peek 已提交
82 83
    autoload :Schema
    autoload :SchemaDumper
84
    autoload :Scoping
J
Joshua Peek 已提交
85 86
    autoload :Serialization
    autoload :SessionStore
87
    autoload :Store
J
Joshua Peek 已提交
88 89
    autoload :Timestamp
    autoload :Transactions
90
    autoload :Translation
J
Joshua Peek 已提交
91 92
    autoload :Validations
  end
D
Initial  
David Heinemeier Hansson 已提交
93

94 95 96 97
  module Coders
    autoload :YAMLColumn, 'active_record/coders/yaml_column'
  end

J
Joshua Peek 已提交
98
  module AttributeMethods
C
Carlhuda 已提交
99 100
    extend ActiveSupport::Autoload

J
Joshua Peek 已提交
101 102 103 104 105 106 107 108
    eager_autoload do
      autoload :BeforeTypeCast
      autoload :Dirty
      autoload :PrimaryKey
      autoload :Query
      autoload :Read
      autoload :TimeZoneConversion
      autoload :Write
109
      autoload :Serialization
J
Joshua Peek 已提交
110
    end
J
Joshua Peek 已提交
111 112
  end

J
Joshua Peek 已提交
113
  module Locking
C
Carlhuda 已提交
114
    extend ActiveSupport::Autoload
115

J
Joshua Peek 已提交
116 117 118 119
    eager_autoload do
      autoload :Optimistic
      autoload :Pessimistic
    end
J
Joshua Peek 已提交
120
  end
121

J
Joshua Peek 已提交
122
  module ConnectionAdapters
C
Carlhuda 已提交
123
    extend ActiveSupport::Autoload
124

J
Joshua Peek 已提交
125 126
    eager_autoload do
      autoload :AbstractAdapter
127
      autoload :ConnectionManagement, "active_record/connection_adapters/abstract/connection_pool"
J
Joshua Peek 已提交
128
    end
J
Joshua Peek 已提交
129
  end
J
Joshua Peek 已提交
130

131 132 133 134 135 136 137 138 139
  module Scoping
    extend ActiveSupport::Autoload

    eager_autoload do
      autoload :Named
      autoload :Default
    end
  end

J
Joshua Peek 已提交
140 141
  autoload :TestCase
  autoload :TestFixtures, 'active_record/fixtures'
142
end
143

144
ActiveSupport.on_load(:active_record) do
145
  Arel::Table.engine = self
J
Joshua Peek 已提交
146
end
S
Sven Fuchs 已提交
147

148
I18n.load_path << File.dirname(__FILE__) + '/active_record/locale/en.yml'