11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/simple_model/error_helpers.rb', line 11
def errors_for_flash(options={})
options = {:failed_action => "saving",
:id => 'errorExplanation',
:classes => ''}.merge!(options)
error_list = ""
{}.merge!(self.errors).each do |error,message|
error_list << create_error_list(error,message)
end
error_string = "<div id='#{options[:id]}' class='#{options[:classes]}'><h2>#{self.errors_count}"
error_string << " #{puralize_errors_string(self.errors)}"
error_string << " prevented #{options[:failed_action]}.</h2><ul>"
error_string << error_list
error_string << "</ul></div>"
error_string
end
|