Skip to content

Commit d88afe4

Browse files
wangjohnrafaelfranca
authored andcommitted
Changing READMEs to refer to ApplicationRecord.
1 parent 9f45fd9 commit d88afe4

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ application into three layers, each with a specific responsibility.
1111
The _Model layer_ represents your domain model (such as Account, Product,
1212
Person, Post, etc.) and encapsulates the business logic that is specific to
1313
your application. In Rails, database-backed model classes are derived from
14-
`ActiveRecord::Base`. Active Record allows you to present the data from
14+
`ActiveRecord::Base` through an application specific subclass called
15+
`ApplicationRecord`. Active Record allows you to present the data from
1516
database rows as objects and embellish these data objects with business logic
1617
methods. You can read more about Active Record in its [README](activerecord/README.rdoc).
1718
Although most Rails models are backed by a database, models can also be ordinary
@@ -23,7 +24,8 @@ providing a suitable response. Usually this means returning HTML, but Rails cont
2324
can also generate XML, JSON, PDFs, mobile-specific views, and more. Controllers load and
2425
manipulate models, and render view templates in order to generate the appropriate HTTP response.
2526
In Rails, incoming requests are routed by Action Dispatch to an appropriate controller, and
26-
controller classes are derived from `ActionController::Base`. Action Dispatch and Action Controller
27+
controller classes are derived from `ActionController::Base` through an application specific
28+
subclass called `ApplicationController`. Action Dispatch and Action Controller
2729
are bundled together in Action Pack. You can read more about Action Pack in its
2830
[README](actionpack/README.rdoc).
2931

activerecord/README.rdoc

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
Active Record connects classes to relational database tables to establish an
44
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 the 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*.
5+
provides a base class, and subclassing an application specific version of
6+
this base class sets up a mapping between the new class and an existing
7+
table in the database. In the context of an application, these classes are
8+
commonly referred to as *models*. Models can also be connected to other
9+
models; this is done by defining *associations*.
910

1011
Active Record relies heavily on naming in that it uses class and association
1112
names to establish mappings between respective database tables and foreign key
@@ -17,7 +18,7 @@ A short rundown of some of the major features:
1718

1819
* Automated mapping between classes and tables, attributes and columns.
1920

20-
class Product < ActiveRecord::Base
21+
class Product < ApplicationRecord
2122
end
2223

2324
{Learn more}[link:classes/ActiveRecord/Base.html]
@@ -37,7 +38,7 @@ This would also define the following accessors: `Product#name` and
3738

3839
* Associations between objects defined by simple class methods.
3940

40-
class Firm < ActiveRecord::Base
41+
class Firm < ApplicationRecord
4142
has_many :clients
4243
has_one :account
4344
belongs_to :conglomerate
@@ -48,7 +49,7 @@ This would also define the following accessors: `Product#name` and
4849

4950
* Aggregations of value objects.
5051

51-
class Account < ActiveRecord::Base
52+
class Account < ApplicationRecord
5253
composed_of :balance, class_name: 'Money',
5354
mapping: %w(balance amount)
5455
composed_of :address,
@@ -60,7 +61,7 @@ This would also define the following accessors: `Product#name` and
6061

6162
* Validation rules that can differ for new or existing objects.
6263

63-
class Account < ActiveRecord::Base
64+
class Account < ApplicationRecord
6465
validates :subdomain, :name, :email_address, :password, presence: true
6566
validates :subdomain, uniqueness: true
6667
validates :terms_of_service, acceptance: true, on: :create
@@ -72,7 +73,7 @@ This would also define the following accessors: `Product#name` and
7273

7374
* Callbacks available for the entire life cycle (instantiation, saving, destroying, validating, etc.).
7475

75-
class Person < ActiveRecord::Base
76+
class Person < ApplicationRecord
7677
before_destroy :invalidate_payment_plan
7778
# the `invalidate_payment_plan` method gets called just before Person#destroy
7879
end
@@ -82,7 +83,7 @@ This would also define the following accessors: `Product#name` and
8283

8384
* Inheritance hierarchies.
8485

85-
class Company < ActiveRecord::Base; end
86+
class Company < ApplicationRecord; end
8687
class Firm < Company; end
8788
class Client < Company; end
8889
class PriorityClient < Client; end

0 commit comments

Comments
 (0)