Sha256: b3d621c5b3e022b7e9f0a7cbb938b63eddd16b71d33b0dab030c2158c722606f

Contents?: true

Size: 392 Bytes

Versions: 7

Compression:

Stored size: 392 Bytes

Contents

module Notable
  module ValidationErrors
    extend ActiveSupport::Concern

    included do
      after_validation :track_validation_errors
    end

    def track_validation_errors
      if errors.any?
        Notable.track "Validation Errors", "#{self.class.name}: #{errors.full_messages.join(", ")}"
      end
    end
  end
end

ActiveRecord::Base.send(:include, Notable::ValidationErrors)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
notable-0.2.2 lib/notable/validation_errors.rb
notable-0.2.1 lib/notable/validation_errors.rb
notable-0.2.0 lib/notable/validation_errors.rb
notable-0.1.0 lib/notable/validation_errors.rb
notable-0.0.3 lib/notable/validation_errors.rb
notable-0.0.2 lib/notable/validation_errors.rb
notable-0.0.1 lib/notable/validation_errors.rb