diff options
author | Genadi Samokovarov <gsamokovarov@gmail.com> | 2015-12-17 11:57:27 +0100 |
---|---|---|
committer | Genadi Samokovarov <gsamokovarov@gmail.com> | 2015-12-17 11:57:41 +0100 |
commit | 4f813a85d8919a83dd6fc019614f6aea7af7d5ae (patch) | |
tree | beb52aad90a34939180cbc9e739cd20e18cf5f05 /guides/source/upgrading_ruby_on_rails.md | |
parent | c29fbd3c7aa6391e820f682a960968aab7a52d07 (diff) | |
download | rails-4f813a85d8919a83dd6fc019614f6aea7af7d5ae.tar.gz rails-4f813a85d8919a83dd6fc019614f6aea7af7d5ae.tar.bz2 rails-4f813a85d8919a83dd6fc019614f6aea7af7d5ae.zip |
ApplicationRecord release notes entry
[ci skip]
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 |