module FatFreeCRM::ActiveModel::Errors

Public Class Methods

included(base) click to toggle source

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.

# 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

Public Instance Methods

each_with_explicit_error(&block) click to toggle source
# File lib/fat_free_crm/errors.rb, line 24
def each_with_explicit_error(&block)
  @errors.each(&block)
end