square-activerecord 3.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/CHANGELOG +6140 -0
  2. data/README.rdoc +222 -0
  3. data/examples/associations.png +0 -0
  4. data/examples/performance.rb +179 -0
  5. data/examples/simple.rb +14 -0
  6. data/lib/active_record.rb +124 -0
  7. data/lib/active_record/aggregations.rb +277 -0
  8. data/lib/active_record/association_preload.rb +430 -0
  9. data/lib/active_record/associations.rb +2307 -0
  10. data/lib/active_record/associations/association_collection.rb +572 -0
  11. data/lib/active_record/associations/association_proxy.rb +299 -0
  12. data/lib/active_record/associations/belongs_to_association.rb +91 -0
  13. data/lib/active_record/associations/belongs_to_polymorphic_association.rb +82 -0
  14. data/lib/active_record/associations/has_and_belongs_to_many_association.rb +143 -0
  15. data/lib/active_record/associations/has_many_association.rb +128 -0
  16. data/lib/active_record/associations/has_many_through_association.rb +115 -0
  17. data/lib/active_record/associations/has_one_association.rb +143 -0
  18. data/lib/active_record/associations/has_one_through_association.rb +40 -0
  19. data/lib/active_record/associations/through_association_scope.rb +154 -0
  20. data/lib/active_record/attribute_methods.rb +60 -0
  21. data/lib/active_record/attribute_methods/before_type_cast.rb +30 -0
  22. data/lib/active_record/attribute_methods/dirty.rb +95 -0
  23. data/lib/active_record/attribute_methods/primary_key.rb +56 -0
  24. data/lib/active_record/attribute_methods/query.rb +39 -0
  25. data/lib/active_record/attribute_methods/read.rb +145 -0
  26. data/lib/active_record/attribute_methods/time_zone_conversion.rb +64 -0
  27. data/lib/active_record/attribute_methods/write.rb +43 -0
  28. data/lib/active_record/autosave_association.rb +369 -0
  29. data/lib/active_record/base.rb +1904 -0
  30. data/lib/active_record/callbacks.rb +284 -0
  31. data/lib/active_record/connection_adapters/abstract/connection_pool.rb +364 -0
  32. data/lib/active_record/connection_adapters/abstract/connection_specification.rb +113 -0
  33. data/lib/active_record/connection_adapters/abstract/database_limits.rb +57 -0
  34. data/lib/active_record/connection_adapters/abstract/database_statements.rb +333 -0
  35. data/lib/active_record/connection_adapters/abstract/query_cache.rb +81 -0
  36. data/lib/active_record/connection_adapters/abstract/quoting.rb +73 -0
  37. data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +739 -0
  38. data/lib/active_record/connection_adapters/abstract/schema_statements.rb +539 -0
  39. data/lib/active_record/connection_adapters/abstract_adapter.rb +217 -0
  40. data/lib/active_record/connection_adapters/mysql_adapter.rb +657 -0
  41. data/lib/active_record/connection_adapters/postgresql_adapter.rb +1031 -0
  42. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +61 -0
  43. data/lib/active_record/connection_adapters/sqlite_adapter.rb +401 -0
  44. data/lib/active_record/counter_cache.rb +115 -0
  45. data/lib/active_record/dynamic_finder_match.rb +56 -0
  46. data/lib/active_record/dynamic_scope_match.rb +23 -0
  47. data/lib/active_record/errors.rb +172 -0
  48. data/lib/active_record/fixtures.rb +1006 -0
  49. data/lib/active_record/locale/en.yml +40 -0
  50. data/lib/active_record/locking/optimistic.rb +172 -0
  51. data/lib/active_record/locking/pessimistic.rb +55 -0
  52. data/lib/active_record/log_subscriber.rb +48 -0
  53. data/lib/active_record/migration.rb +617 -0
  54. data/lib/active_record/named_scope.rb +138 -0
  55. data/lib/active_record/nested_attributes.rb +419 -0
  56. data/lib/active_record/observer.rb +125 -0
  57. data/lib/active_record/persistence.rb +290 -0
  58. data/lib/active_record/query_cache.rb +36 -0
  59. data/lib/active_record/railtie.rb +91 -0
  60. data/lib/active_record/railties/controller_runtime.rb +38 -0
  61. data/lib/active_record/railties/databases.rake +512 -0
  62. data/lib/active_record/reflection.rb +411 -0
  63. data/lib/active_record/relation.rb +394 -0
  64. data/lib/active_record/relation/batches.rb +89 -0
  65. data/lib/active_record/relation/calculations.rb +295 -0
  66. data/lib/active_record/relation/finder_methods.rb +363 -0
  67. data/lib/active_record/relation/predicate_builder.rb +48 -0
  68. data/lib/active_record/relation/query_methods.rb +303 -0
  69. data/lib/active_record/relation/spawn_methods.rb +132 -0
  70. data/lib/active_record/schema.rb +59 -0
  71. data/lib/active_record/schema_dumper.rb +195 -0
  72. data/lib/active_record/serialization.rb +60 -0
  73. data/lib/active_record/serializers/xml_serializer.rb +244 -0
  74. data/lib/active_record/session_store.rb +340 -0
  75. data/lib/active_record/test_case.rb +67 -0
  76. data/lib/active_record/timestamp.rb +88 -0
  77. data/lib/active_record/transactions.rb +359 -0
  78. data/lib/active_record/validations.rb +84 -0
  79. data/lib/active_record/validations/associated.rb +48 -0
  80. data/lib/active_record/validations/uniqueness.rb +190 -0
  81. data/lib/active_record/version.rb +10 -0
  82. data/lib/rails/generators/active_record.rb +19 -0
  83. data/lib/rails/generators/active_record/migration.rb +15 -0
  84. data/lib/rails/generators/active_record/migration/migration_generator.rb +25 -0
  85. data/lib/rails/generators/active_record/migration/templates/migration.rb +17 -0
  86. data/lib/rails/generators/active_record/model/model_generator.rb +38 -0
  87. data/lib/rails/generators/active_record/model/templates/migration.rb +16 -0
  88. data/lib/rails/generators/active_record/model/templates/model.rb +5 -0
  89. data/lib/rails/generators/active_record/model/templates/module.rb +5 -0
  90. data/lib/rails/generators/active_record/observer/observer_generator.rb +15 -0
  91. data/lib/rails/generators/active_record/observer/templates/observer.rb +2 -0
  92. data/lib/rails/generators/active_record/session_migration/session_migration_generator.rb +24 -0
  93. data/lib/rails/generators/active_record/session_migration/templates/migration.rb +16 -0
  94. metadata +223 -0
@@ -0,0 +1,222 @@
1
+ = Active Record -- Object-relational mapping put on rails
2
+
3
+ Active Record connects classes to relational database tables to establish an
4
+ almost zero-configuration persistence layer for applications. The library
5
+ provides a base class that, when subclassed, sets up a mapping between the new
6
+ class and an existing table in the database. In context of an application,
7
+ these classes are commonly referred to as *models*. Models can also be
8
+ connected to other models; this is done by defining *associations*.
9
+
10
+ Active Record relies heavily on naming in that it uses class and association
11
+ names to establish mappings between respective database tables and foreign key
12
+ columns. Although these mappings can be defined explicitly, it's recommended
13
+ to follow naming conventions, especially when getting started with the
14
+ library.
15
+
16
+ A short rundown of some of the major features:
17
+
18
+ * Automated mapping between classes and tables, attributes and columns.
19
+
20
+ class Product < ActiveRecord::Base
21
+ end
22
+
23
+ The Product class is automatically mapped to the table named "products",
24
+ which might look like this:
25
+
26
+ CREATE TABLE products (
27
+ id int(11) NOT NULL auto_increment,
28
+ name varchar(255),
29
+ PRIMARY KEY (id)
30
+ );
31
+
32
+ This would also define the following accessors: `Product#name` and
33
+ `Product#name=(new_name)`
34
+
35
+ {Learn more}[link:classes/ActiveRecord/Base.html]
36
+
37
+
38
+ * Associations between objects defined by simple class methods.
39
+
40
+ class Firm < ActiveRecord::Base
41
+ has_many :clients
42
+ has_one :account
43
+ belongs_to :conglomerate
44
+ end
45
+
46
+ {Learn more}[link:classes/ActiveRecord/Associations/ClassMethods.html]
47
+
48
+
49
+ * Aggregations of value objects.
50
+
51
+ class Account < ActiveRecord::Base
52
+ composed_of :balance, :class_name => "Money",
53
+ :mapping => %w(balance amount)
54
+ composed_of :address,
55
+ :mapping => [%w(address_street street), %w(address_city city)]
56
+ end
57
+
58
+ {Learn more}[link:classes/ActiveRecord/Aggregations/ClassMethods.html]
59
+
60
+
61
+ * Validation rules that can differ for new or existing objects.
62
+
63
+ class Account < ActiveRecord::Base
64
+ validates_presence_of :subdomain, :name, :email_address, :password
65
+ validates_uniqueness_of :subdomain
66
+ validates_acceptance_of :terms_of_service, :on => :create
67
+ validates_confirmation_of :password, :email_address, :on => :create
68
+ end
69
+
70
+ {Learn more}[link:classes/ActiveRecord/Validations.html]
71
+
72
+
73
+ * Callbacks available for the entire life cycle (instantiation, saving, destroying, validating, etc.)
74
+
75
+ class Person < ActiveRecord::Base
76
+ before_destroy :invalidate_payment_plan
77
+ # the `invalidate_payment_plan` method gets called just before Person#destroy
78
+ end
79
+
80
+ {Learn more}[link:classes/ActiveRecord/Callbacks.html]
81
+
82
+
83
+ * Observers that react to changes in a model
84
+
85
+ class CommentObserver < ActiveRecord::Observer
86
+ def after_create(comment) # is called just after Comment#save
87
+ Notifications.deliver_new_comment("david@loudthinking.com", comment)
88
+ end
89
+ end
90
+
91
+ {Learn more}[link:classes/ActiveRecord/Observer.html]
92
+
93
+
94
+ * Inheritance hierarchies
95
+
96
+ class Company < ActiveRecord::Base; end
97
+ class Firm < Company; end
98
+ class Client < Company; end
99
+ class PriorityClient < Client; end
100
+
101
+ {Learn more}[link:classes/ActiveRecord/Base.html]
102
+
103
+
104
+ * Transactions
105
+
106
+ # Database transaction
107
+ Account.transaction do
108
+ david.withdrawal(100)
109
+ mary.deposit(100)
110
+ end
111
+
112
+ {Learn more}[link:classes/ActiveRecord/Transactions/ClassMethods.html]
113
+
114
+
115
+ * Reflections on columns, associations, and aggregations
116
+
117
+ reflection = Firm.reflect_on_association(:clients)
118
+ reflection.klass # => Client (class)
119
+ Firm.columns # Returns an array of column descriptors for the firms table
120
+
121
+ {Learn more}[link:classes/ActiveRecord/Reflection/ClassMethods.html]
122
+
123
+
124
+ * Database abstraction through simple adapters
125
+
126
+ # connect to SQLite3
127
+ ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => "dbfile.sqlite3")
128
+
129
+ # connect to MySQL with authentication
130
+ ActiveRecord::Base.establish_connection(
131
+ :adapter => "mysql",
132
+ :host => "localhost",
133
+ :username => "me",
134
+ :password => "secret",
135
+ :database => "activerecord"
136
+ )
137
+
138
+ {Learn more}[link:classes/ActiveRecord/Base.html] and read about the built-in support for
139
+ MySQL[link:classes/ActiveRecord/ConnectionAdapters/MysqlAdapter.html],
140
+ PostgreSQL[link:classes/ActiveRecord/ConnectionAdapters/PostgreSQLAdapter.html], and
141
+ SQLite3[link:classes/ActiveRecord/ConnectionAdapters/SQLite3Adapter.html].
142
+
143
+
144
+ * Logging support for Log4r[http://log4r.sourceforge.net] and Logger[http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc]
145
+
146
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
147
+ ActiveRecord::Base.logger = Log4r::Logger.new("Application Log")
148
+
149
+
150
+ * Database agnostic schema management with Migrations
151
+
152
+ class AddSystemSettings < ActiveRecord::Migration
153
+ def self.up
154
+ create_table :system_settings do |t|
155
+ t.string :name
156
+ t.string :label
157
+ t.text :value
158
+ t.string :type
159
+ t.integer :position
160
+ end
161
+
162
+ SystemSetting.create :name => "notice", :label => "Use notice?", :value => 1
163
+ end
164
+
165
+ def self.down
166
+ drop_table :system_settings
167
+ end
168
+ end
169
+
170
+ {Learn more}[link:classes/ActiveRecord/Migration.html]
171
+
172
+
173
+ == Philosophy
174
+
175
+ Active Record is an implementation of the object-relational mapping (ORM)
176
+ pattern[http://www.martinfowler.com/eaaCatalog/activeRecord.html] by the same
177
+ name described by Martin Fowler:
178
+
179
+ "An object that wraps a row in a database table or view,
180
+ encapsulates the database access, and adds domain logic on that data."
181
+
182
+ Active Record attempts to provide a coherent wrapper as a solution for the inconvenience that is
183
+ object-relational mapping. The prime directive for this mapping has been to minimize
184
+ the amount of code needed to build a real-world domain model. This is made possible
185
+ by relying on a number of conventions that make it easy for Active Record to infer
186
+ complex relations and structures from a minimal amount of explicit direction.
187
+
188
+ Convention over Configuration:
189
+ * No XML-files!
190
+ * Lots of reflection and run-time extension
191
+ * Magic is not inherently a bad word
192
+
193
+ Admit the Database:
194
+ * Lets you drop down to SQL for odd cases and performance
195
+ * Doesn't attempt to duplicate or replace data definitions
196
+
197
+
198
+ == Download and installation
199
+
200
+ The latest version of Active Record can be installed with Rubygems:
201
+
202
+ % [sudo] gem install activerecord
203
+
204
+ Source code can be downloaded as part of the Rails project on GitHub
205
+
206
+ * http://github.com/rails/rails/tree/master/activerecord/
207
+
208
+
209
+ == License
210
+
211
+ Active Record is released under the MIT license.
212
+
213
+
214
+ == Support
215
+
216
+ API documentation is at
217
+
218
+ * http://api.rubyonrails.com
219
+
220
+ Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:
221
+
222
+ * https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets
Binary file
@@ -0,0 +1,179 @@
1
+ #!/usr/bin/env ruby -KU
2
+
3
+ TIMES = (ENV['N'] || 10000).to_i
4
+ require 'rubygems'
5
+
6
+ gem 'addressable', '~>2.0'
7
+ gem 'faker', '~>0.3.1'
8
+ gem 'rbench', '~>0.2.3'
9
+
10
+ require 'addressable/uri'
11
+ require 'faker'
12
+ require 'rbench'
13
+
14
+ require File.expand_path("../../../load_paths", __FILE__)
15
+ require "active_record"
16
+
17
+ conn = { :adapter => 'mysql',
18
+ :database => 'activerecord_unittest',
19
+ :username => 'rails', :password => '',
20
+ :encoding => 'utf8' }
21
+
22
+ conn[:socket] = Pathname.glob(%w[
23
+ /opt/local/var/run/mysql5/mysqld.sock
24
+ /tmp/mysqld.sock
25
+ /tmp/mysql.sock
26
+ /var/mysql/mysql.sock
27
+ /var/run/mysqld/mysqld.sock
28
+ ]).find { |path| path.socket? }.to_s
29
+
30
+ ActiveRecord::Base.establish_connection(conn)
31
+
32
+ class User < ActiveRecord::Base
33
+ connection.create_table :users, :force => true do |t|
34
+ t.string :name, :email
35
+ t.timestamps
36
+ end
37
+
38
+ has_many :exhibits
39
+ end
40
+
41
+ class Exhibit < ActiveRecord::Base
42
+ connection.create_table :exhibits, :force => true do |t|
43
+ t.belongs_to :user
44
+ t.string :name
45
+ t.text :notes
46
+ t.timestamps
47
+ end
48
+
49
+ belongs_to :user
50
+
51
+ def look; attributes end
52
+ def feel; look; user.name end
53
+
54
+ def self.look(exhibits) exhibits.each { |e| e.look } end
55
+ def self.feel(exhibits) exhibits.each { |e| e.feel } end
56
+ end
57
+
58
+ sqlfile = File.expand_path("../performance.sql", __FILE__)
59
+
60
+ if File.exists?(sqlfile)
61
+ mysql_bin = %w[mysql mysql5].detect { |bin| `which #{bin}`.length > 0 }
62
+ `#{mysql_bin} -u #{conn[:username]} #{"-p#{conn[:password]}" unless conn[:password].blank?} #{conn[:database]} < #{sqlfile}`
63
+ else
64
+ puts 'Generating data...'
65
+
66
+ # pre-compute the insert statements and fake data compilation,
67
+ # so the benchmarks below show the actual runtime for the execute
68
+ # method, minus the setup steps
69
+
70
+ # Using the same paragraph for all exhibits because it is very slow
71
+ # to generate unique paragraphs for all exhibits.
72
+ notes = Faker::Lorem.paragraphs.join($/)
73
+ today = Date.today
74
+
75
+ puts 'Inserting 10,000 users and exhibits...'
76
+ 10_000.times do
77
+ user = User.create(
78
+ :created_at => today,
79
+ :name => Faker::Name.name,
80
+ :email => Faker::Internet.email
81
+ )
82
+
83
+ Exhibit.create(
84
+ :created_at => today,
85
+ :name => Faker::Company.name,
86
+ :user => user,
87
+ :notes => notes
88
+ )
89
+ end
90
+
91
+ mysqldump_bin = %w[mysqldump mysqldump5].select { |bin| `which #{bin}`.length > 0 }
92
+ `#{mysqldump_bin} -u #{conn[:username]} #{"-p#{conn[:password]}" unless conn[:password].blank?} #{conn[:database]} exhibits users > #{sqlfile}`
93
+ end
94
+
95
+ RBench.run(TIMES) do
96
+ column :times
97
+ column :ar
98
+
99
+ report 'Model#id', (TIMES * 100).ceil do
100
+ ar_obj = Exhibit.find(1)
101
+
102
+ ar { ar_obj.id }
103
+ end
104
+
105
+ report 'Model.new (instantiation)' do
106
+ ar { Exhibit.new }
107
+ end
108
+
109
+ report 'Model.new (setting attributes)' do
110
+ attrs = { :name => 'sam' }
111
+ ar { Exhibit.new(attrs) }
112
+ end
113
+
114
+ report 'Model.first' do
115
+ ar { Exhibit.first.look }
116
+ end
117
+
118
+ report 'Model.all limit(100)', (TIMES / 10).ceil do
119
+ ar { Exhibit.look Exhibit.limit(100) }
120
+ end
121
+
122
+ report 'Model.all limit(100) with relationship', (TIMES / 10).ceil do
123
+ ar { Exhibit.feel Exhibit.limit(100).includes(:user) }
124
+ end
125
+
126
+ report 'Model.all limit(10,000)', (TIMES / 1000).ceil do
127
+ ar { Exhibit.look Exhibit.limit(10000) }
128
+ end
129
+
130
+ exhibit = {
131
+ :name => Faker::Company.name,
132
+ :notes => Faker::Lorem.paragraphs.join($/),
133
+ :created_at => Date.today
134
+ }
135
+
136
+ report 'Model.create' do
137
+ ar { Exhibit.create(exhibit) }
138
+ end
139
+
140
+ report 'Resource#attributes=' do
141
+ attrs_first = { :name => 'sam' }
142
+ attrs_second = { :name => 'tom' }
143
+ ar { exhibit = Exhibit.new(attrs_first); exhibit.attributes = attrs_second }
144
+ end
145
+
146
+ report 'Resource#update' do
147
+ ar { Exhibit.first.update_attributes(:name => 'bob') }
148
+ end
149
+
150
+ report 'Resource#destroy' do
151
+ ar { Exhibit.first.destroy }
152
+ end
153
+
154
+ report 'Model.transaction' do
155
+ ar { Exhibit.transaction { Exhibit.new } }
156
+ end
157
+
158
+ report 'Model.find(id)' do
159
+ id = Exhibit.first.id
160
+ ar { Exhibit.find(id) }
161
+ end
162
+
163
+ report 'Model.find_by_sql' do
164
+ ar { Exhibit.find_by_sql("SELECT * FROM exhibits WHERE id = #{(rand * 1000 + 1).to_i}").first }
165
+ end
166
+
167
+ report 'Model.log', (TIMES * 10) do
168
+ ar { Exhibit.connection.send(:log, "hello", "world") {} }
169
+ end
170
+
171
+ report 'AR.execute(query)', (TIMES / 2) do
172
+ ar { ActiveRecord::Base.connection.execute("Select * from exhibits where id = #{(rand * 1000 + 1).to_i}") }
173
+ end
174
+
175
+ summary 'Total'
176
+ end
177
+
178
+ ActiveRecord::Migration.drop_table "exhibits"
179
+ ActiveRecord::Migration.drop_table "users"
@@ -0,0 +1,14 @@
1
+ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
2
+ require 'active_record'
3
+
4
+ class Person < ActiveRecord::Base
5
+ establish_connection :adapter => 'sqlite3', :database => 'foobar.db'
6
+ connection.create_table table_name, :force => true do |t|
7
+ t.string :name
8
+ end
9
+ end
10
+
11
+ bob = Person.create!(:name => 'bob')
12
+ puts Person.all.inspect
13
+ bob.destroy
14
+ puts Person.all.inspect
@@ -0,0 +1,124 @@
1
+ #--
2
+ # Copyright (c) 2004-2010 David Heinemeier Hansson
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+
25
+ activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
26
+ $:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
27
+
28
+ activemodel_path = File.expand_path('../../../activemodel/lib', __FILE__)
29
+ $:.unshift(activemodel_path) if File.directory?(activemodel_path) && !$:.include?(activemodel_path)
30
+
31
+ require 'active_support'
32
+ require 'active_support/i18n'
33
+ require 'active_model'
34
+ require 'arel'
35
+
36
+ require 'active_record/version'
37
+
38
+ module ActiveRecord
39
+ extend ActiveSupport::Autoload
40
+
41
+ eager_autoload do
42
+ autoload :ActiveRecordError, 'active_record/errors'
43
+ autoload :ConnectionNotEstablished, 'active_record/errors'
44
+
45
+ autoload :Aggregations
46
+ autoload :AssociationPreload
47
+ autoload :Associations
48
+ autoload :AttributeMethods
49
+ autoload :AutosaveAssociation
50
+
51
+ autoload :Relation
52
+
53
+ autoload_under 'relation' do
54
+ autoload :QueryMethods
55
+ autoload :FinderMethods
56
+ autoload :Calculations
57
+ autoload :PredicateBuilder
58
+ autoload :SpawnMethods
59
+ autoload :Batches
60
+ end
61
+
62
+ autoload :Base
63
+ autoload :Callbacks
64
+ autoload :CounterCache
65
+ autoload :DynamicFinderMatch
66
+ autoload :DynamicScopeMatch
67
+ autoload :Migration
68
+ autoload :Migrator, 'active_record/migration'
69
+ autoload :NamedScope
70
+ autoload :NestedAttributes
71
+ autoload :Observer
72
+ autoload :Persistence
73
+ autoload :QueryCache
74
+ autoload :Reflection
75
+ autoload :Schema
76
+ autoload :SchemaDumper
77
+ autoload :Serialization
78
+ autoload :SessionStore
79
+ autoload :Timestamp
80
+ autoload :Transactions
81
+ autoload :Validations
82
+ end
83
+
84
+ module AttributeMethods
85
+ extend ActiveSupport::Autoload
86
+
87
+ eager_autoload do
88
+ autoload :BeforeTypeCast
89
+ autoload :Dirty
90
+ autoload :PrimaryKey
91
+ autoload :Query
92
+ autoload :Read
93
+ autoload :TimeZoneConversion
94
+ autoload :Write
95
+ end
96
+ end
97
+
98
+ module Locking
99
+ extend ActiveSupport::Autoload
100
+
101
+ eager_autoload do
102
+ autoload :Optimistic
103
+ autoload :Pessimistic
104
+ end
105
+ end
106
+
107
+ module ConnectionAdapters
108
+ extend ActiveSupport::Autoload
109
+
110
+ eager_autoload do
111
+ autoload :AbstractAdapter
112
+ autoload :ConnectionManagement, "active_record/connection_adapters/abstract/connection_pool"
113
+ end
114
+ end
115
+
116
+ autoload :TestCase
117
+ autoload :TestFixtures, 'active_record/fixtures'
118
+ end
119
+
120
+ ActiveSupport.on_load(:active_record) do
121
+ Arel::Table.engine = self
122
+ end
123
+
124
+ I18n.load_path << File.dirname(__FILE__) + '/active_record/locale/en.yml'