Sha256: 6c0c0fe875051d0a2ab8cb215170ae7f0eea7d2f3b63ff2c976f2bf56b004f87
Contents?: true
Size: 947 Bytes
Versions: 5
Compression:
Stored size: 947 Bytes
Contents
## # <Rails.root>/lib/skn_utils/result_bean_with_errors.rb # # *** See SknUtils::NestedResultBase for details *** # ## # (Defaults) # :enable_serialization = false -- for speed # :depth = :multi ## # Add the ActiveModel::Errors Object to bean structure, and # filters @errors out of serialization features; i.e. not included in *.attributes() # # bean.errors.add(:name, "can not be nil") if name == nil ### module SknUtils class ResultBeanWithErrors < NestedResultBase include ActiveModel::Conversion extend ActiveModel::Naming attr_reader :errors def initialize(params={}) @errors = params.delete :errors @errors = ActiveModel::Errors.new(self) unless @errors.present? super(params) end def read_attribute_for_validation(attr) send(attr) end def self.human_attribute_name(attr, options = {}) attr end def self.lookup_ancestors [self] end end end
Version data entries
5 entries across 5 versions & 1 rubygems