diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-12-17 12:16:07 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-12-17 12:16:07 +0100 |
commit | 1bfce3f29d958a14ca1502d3d36a9a2bc1de3734 (patch) | |
tree | c170df3f5d2886a669ad757af931a8bb515b0202 /guides/source/upgrading_ruby_on_rails.md | |
parent | 48f5cecdb03f697a710169ccef1885fcaca70788 (diff) | |
parent | 4f813a85d8919a83dd6fc019614f6aea7af7d5ae (diff) | |
download | rails-1bfce3f29d958a14ca1502d3d36a9a2bc1de3734.tar.gz rails-1bfce3f29d958a14ca1502d3d36a9a2bc1de3734.tar.bz2 rails-1bfce3f29d958a14ca1502d3d36a9a2bc1de3734.zip |
Merge pull request #22626 from gsamokovarov/appliation-record-documentation-fixes
Appliation record documentation fixes
Diffstat (limited to 'guides/source/upgrading_ruby_on_rails.md')
-rw-r--r-- | guides/source/upgrading_ruby_on_rails.md | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 9ba5021c4a..58fda3aa0d 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -53,6 +53,25 @@ Don't forget to review the difference, to see if there were any unexpected chang Upgrading from Rails 4.2 to Rails 5.0 ------------------------------------- +### Active Record models now inherit from ApplicationRecord by default + +In Rails 4.2 an Active Job inherits from `ActiveRecord::Base`. In Rails 5.0 models +inherit from `ApplicationRecord`. + +`ApplicationRecord` is a new superclass for all app models, analogous to app +controllers subclassing ApplicationController instead of +ActionController::Base. This gives apps a single spot to configure app-wide +model behavior + +When upgrading from Rails 4.2 to Rails 5.0 you need to create an +`application_record.rb` file in `app/models/` and add the following content: + +``` +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end +``` + ### Halting callback chains via `throw(:abort)` In Rails 4.2, when a 'before' callback returns `false` in Active Record |