Sha256: 3206ad7d67c61d582cdda3fcdb635b6b679c0654861533051e635c57a53e8259

Contents?: true

Size: 462 Bytes

Versions: 1

Compression:

Stored size: 462 Bytes

Contents

require "rubocop"

module RuboCop
  module Cop
    module GitHub
      class ApplicationRecord < Cop
        MSG = "Models should subclass from ApplicationRecord"

        ACTIVE_RECORD_BASE = s(:const, s(:const, nil, :ActiveRecord), :Base)

        def on_class(node)
          _name, superclass, _body = *node

          if superclass == ACTIVE_RECORD_BASE
            add_offense(superclass, :expression)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-github-0.1.0 lib/rubocop/cop/github/application_record.rb