Welcome to mirror list, hosted at ThFree Co, Russian Federation.

active_record_serialize.rb « cop « rubocop - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 204caf37f8b84af2928c15d09fae990d8914f763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require_relative '../model_helpers'

module RuboCop
  module Cop
    # Cop that prevents the use of `serialize` in ActiveRecord models.
    class ActiveRecordSerialize < RuboCop::Cop::Cop
      include ModelHelpers

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

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

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