Sha256: 7963f39b4f4f04c672916b283b45053e10535f1657c2ad27cd7aa015628238dc

Contents?: true

Size: 540 Bytes

Versions: 3

Compression:

Stored size: 540 Bytes

Contents

module SimpleModel
  module ErrorHelpers

    def errors?
      !self.errors.nil? && !self.errors.empty?
    end

    def errors_for_flash
      error_string = "<div id='smErrorExplanation'>#{self.errors.count} errors prevented saving.</div>"
      self.errors.full_messages.each do |m|
        error_string << "<div>#{m}</div>"
      end
      error_string
    end
  
    def errors_to_s
      error_string = ""
      self.errors.full_messages.each do |m|
        error_string << "#{m} "
      end
      error_string
    end
   
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_model-0.1.7 lib/simple_model/error_helpers.rb
simple_model-0.1.6 lib/simple_model/error_helpers.rb
simple_model-0.1.5 lib/simple_model/error_helpers.rb