Sha256: 88aa3256e6c388aea93d920df2b0cb7b626b83d2d4c89aa5e8413c67410e3373
Contents?: true
Size: 699 Bytes
Versions: 1
Compression:
Stored size: 699 Bytes
Contents
module TransForms class FormErrors attr_accessor :form_model, :original def initialize(form_model, original) self.form_model, self.original = form_model, original end def error_models [original, form_model.main_instance.try(:errors)].compact end def full_messages original.full_messages end def clear error_models.each do |em| em.clear end end def [](key) error_models.inject([]) { |acc, error_model| acc += (error_model[key]) } end def empty? error_models.all?(&:empty?) end def method_missing(m, *args, &block) original.send(m, *args, &block) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
trans_forms-0.1.0 | lib/trans_forms/form_errors.rb |