Class: RuboCop::Cop::Rails::ApplicationRecord
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Rails::ApplicationRecord
- Extended by:
- AutoCorrector, TargetRailsVersion
- Includes:
- EnforceSuperclass
- Defined in:
- lib/rubocop/cop/rails/application_record.rb
Overview
Checks that models subclass ‘ApplicationRecord` with Rails 5.0.
It is a common practice to define models inside migrations in order to retain forward compatibility by avoiding loading any application code. And so migration files are excluded by default for this cop.
Constant Summary collapse
- MSG =
'Models should subclass `ApplicationRecord`.'
- SUPERCLASS =
'ApplicationRecord'
- BASE_PATTERN =
'(const (const {nil? cbase} :ActiveRecord) :Base)'
Constants included from TargetRailsVersion
TargetRailsVersion::TARGET_GEM_NAME, TargetRailsVersion::USES_REQUIRES_GEM_API
Method Summary
Methods included from TargetRailsVersion
minimum_target_rails_version, support_target_rails_version?