Sha256: 8e7ec29bb99423a6a691ab19d26c7e954ca49c427955fd3db38f3545081c8db5

Contents?: true

Size: 399 Bytes

Versions: 3

Compression:

Stored size: 399 Bytes

Contents

# frozen_string_literal: true
module Beespew
  module Model
    extend ActiveSupport::Concern

    included do
      attr_accessor Beespew.attribute
      validate :beespew_honeypot_must_be_blank
    end

    def spam?
      send(Beespew.attribute).present?
    end

    private

    def beespew_honeypot_must_be_blank
      errors.add(:base, 'spam protection in place') if spam?
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
beespew-2.1.0 lib/beespew/model.rb
beespew-2.0.0 lib/beespew/model.rb
beespew-1.0.1 lib/beespew/model.rb