Module: FatFreeCRM::ActiveModel::Errors

Defined in:
lib/fat_free_crm/errors.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Override ActiveModel::Errors#each so we could display validation errors as is without rendering the attribute name. Simply place a caret as the first character of the error message.

This feature was handled by ‘advanced_errors’ plugin in Rails 2.x version of Fat Free CRM.




18
19
20
21
22
# File 'lib/fat_free_crm/errors.rb', line 18

def self.included(base)
  base.class_eval do
    alias_method :each, :each_with_explicit_error
  end
end

Instance Method Details

#each_with_explicit_error(&block) ⇒ Object



24
25
26
# File 'lib/fat_free_crm/errors.rb', line 24

def each_with_explicit_error(&block)
  @errors.each(&block)
end