Class: Gitlab::Styles::Rubocop::Cop::ActiveRecordSerialize

Inherits:
RuboCop::Cop::Cop
  • Object
show all
Includes:
ModelHelpers
Defined in:
lib/gitlab/styles/rubocop/cop/active_record_serialize.rb

Overview

Cop that prevents the use of ‘serialize` in ActiveRecord models.

Constant Summary collapse

MSG =
'Do not store serialized data in the database, use separate columns and/or tables instead'

Instance Method Summary collapse

Methods included from ModelHelpers

#in_model?

Instance Method Details

#on_send(node) ⇒ Object



15
16
17
18
19
# File 'lib/gitlab/styles/rubocop/cop/active_record_serialize.rb', line 15

def on_send(node)
  return unless in_model?(node)

  add_offense(node, location: :selector) if node.children[1] == :serialize
end