Class: RuboCop::Cop::GitHub::RailsApplicationRecord

Inherits:
RuboCop::Cop
  • Object
show all
Defined in:
lib/rubocop/cop/github/rails_application_record.rb

Constant Summary collapse

MSG =
"Models should subclass from ApplicationRecord"

Instance Method Summary collapse

Instance Method Details

#on_class(node) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/rubocop/cop/github/rails_application_record.rb', line 19

def on_class(node)
  klass, superclass, _ = *node

  if active_record_base_const?(superclass) && !(application_record_const?(klass))
    add_offense(superclass, :expression)
  end
end