Sha256: 062d920afe64e9a71140f92ec1acaa266d4febd7b20a84cb47abee55daa00fe8
Contents?: true
Size: 539 Bytes
Versions: 9
Compression:
Stored size: 539 Bytes
Contents
module PhModel module Concerns # Validates factories. module ValidatedFactory extend ActiveSupport::Concern included do |model| class << model private :new end end # Validates factories. module ClassMethods def build(*args) new(*args).tap do |model| unless model.valid? raise ValidationFailed, "#{name} is invalid: #{model.errors.full_messages.join("\n")}" end end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems