simple_model 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,22 @@ module SimpleModel
5
5
  !self.errors.nil? && !self.errors.empty?
6
6
  end
7
7
 
8
- def errors_for_flash
9
- error_string = "<div id='smErrorExplanation'>#{self.errors.count} errors prevented saving.</div>"
8
+ def errors_for_flash(options={})
9
+ options[:failed_action] ||= "saving"
10
+ options[:id] ||= 'errorExplanation'
11
+ options[:classes] ||= ''
12
+ error_string = "<div id='#{options[:id]}' class='#{options[:classes]}'><h2>#{self.errors.count}"
13
+ if self.errors.length > 1
14
+ error_string << " errors"
15
+ else
16
+ error_string << " error"
17
+ end
18
+ error_string << " prevented #{options[:failed_action]}.</h2><ul>"
19
+
10
20
  self.errors.full_messages.each do |m|
11
- error_string << "<div>#{m}</div>"
21
+ error_string << "<li>#{m}</li>"
12
22
  end
23
+ error_string << "</ul></div>"
13
24
  error_string
14
25
  end
15
26
 
@@ -1,3 +1,3 @@
1
1
  module SimpleModel
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_model
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 7
9
- version: 0.1.7
4
+ prerelease:
5
+ version: 0.1.8
10
6
  platform: ruby
11
7
  authors:
12
8
  - Joshua T Mckinney
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-02-07 00:00:00 -06:00
13
+ date: 2011-02-12 00:00:00 -06:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -25,10 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - "="
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 2
30
- - 4
31
- - 0
32
24
  version: 2.4.0
33
25
  type: :development
34
26
  version_requirements: *id001
@@ -76,21 +68,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
68
  requirements:
77
69
  - - ">="
78
70
  - !ruby/object:Gem::Version
79
- segments:
80
- - 0
81
71
  version: "0"
82
72
  required_rubygems_version: !ruby/object:Gem::Requirement
83
73
  none: false
84
74
  requirements:
85
75
  - - ">="
86
76
  - !ruby/object:Gem::Version
87
- segments:
88
- - 0
89
77
  version: "0"
90
78
  requirements: []
91
79
 
92
80
  rubyforge_project: simple_model
93
- rubygems_version: 1.3.7
81
+ rubygems_version: 1.5.0
94
82
  signing_key:
95
83
  specification_version: 3
96
84
  summary: Simpifies building tableless models or models backed by webservices