Module: Rails::API::HashValidationErrors

Defined in:
lib/rails/api/hash_validation_errors.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
# File 'lib/rails/api/hash_validation_errors.rb', line 3

def self.included(base)
  base.send :around_filter, :use_hash_validation_errors
end

Instance Method Details

#use_hash_validation_errors(&block) ⇒ Object



7
8
9
10
11
12
# File 'lib/rails/api/hash_validation_errors.rb', line 7

def use_hash_validation_errors(&block)
  ActiveModel::Errors.disable_translations
  yield
ensure
  ActiveModel::Errors.enable_translations
end