Sha256: c523bb24919ec6a01023e183791cd0c3e79b569081f46d814c6ef628d0abf7a2

Contents?: true

Size: 593 Bytes

Versions: 2

Compression:

Stored size: 593 Bytes

Contents

# frozen_string_literal: true

module Rubocop
  module Cop
    # Cop that prevents the use of `serialize` in ActiveRecord models.
    #
    # @example
    #   # bad
    #   serialize :preferences
    #
    #   # good
    #   # Column for each individual preference
    class ActiveRecordSerialize < RuboCop::Cop::Base
      MSG = 'Do not store serialized data in the database, use separate columns and/or tables instead'

      RESTRICT_ON_SEND = %i[serialize].freeze

      def on_send(node)
        return if node.receiver

        add_offense(node.loc.selector)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gitlab-styles-13.0.1 lib/rubocop/cop/active_record_serialize.rb
gitlab-styles-13.0.0 lib/rubocop/cop/active_record_serialize.rb