Class: Lev::Handler::ErrorTransferer
- Inherits:
-
Object
- Object
- Lev::Handler::ErrorTransferer
- Defined in:
- lib/lev/handler/error_transferer.rb
Class Method Summary collapse
Class Method Details
.transfer(source, handler_target, param_group) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lev/handler/error_transferer.rb', line 5 def self.transfer(source, handler_target, param_group) case source when ActiveRecord::Base, Lev::Paramifier source.errors. do |attribute, type, | handler_target.errors.add( code: type, data: { model: source, attribute: attribute }, kind: :activerecord, message: , offending_params: [param_group].flatten << attribute ) end else raise Exception end end |