combined_errors 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,7 +7,7 @@ Sometimes you want to use SimpleForm and have 2 or 3 inputs on the same line. L
7
7
  = f.input :name
8
8
  = f.input :address_line_1
9
9
  = f.input :address_line_2
10
- = f.input :city_state_zip do
10
+ = f.input :city_state_zip, label: 'City' do
11
11
  = f.input_field :city, class: 'input-medium'
12
12
  = f.input_field :state, collection: State.all
13
13
  = f.input_field :zip, class: 'input-small'
@@ -24,6 +24,7 @@ But it would be nice if the errors still stacked up nicely. That's where Combin
24
24
  combine_errors :city_state_zip, [:city, :state, :zip]
25
25
  end
26
26
 
27
+
27
28
  ## Installation
28
29
 
29
30
  Add this line to your application's Gemfile:
@@ -38,6 +39,17 @@ Or install it yourself as:
38
39
 
39
40
  $ gem install combined_errors
40
41
 
42
+ ## Usage
43
+
44
+ You probably want to adjust <code>config.error_method</code> in <code>config/initializer/simple_form.rb</code> to be <code>:to_sentence</code>
45
+
46
+ You can make this work without ActiveRecord by:
47
+
48
+ * extending <code>CombinedErrors::Model</code>
49
+ * making an 'errors' method that returns an object which
50
+ - responds to <code>[]</code> like a hash
51
+ - responds to <code>add(key, message)</code>
52
+
41
53
  ## Contributing
42
54
 
43
55
  1. Fork it
@@ -6,7 +6,7 @@ module CombinedErrors
6
6
  define_method new_method do
7
7
  methods_to_combine.flatten.each do |m|
8
8
  if errors[m].any?
9
- title = m.to_s.respond_to?(:titleize) ? m.titleize : m.capitalize
9
+ title = m.to_s.respond_to?(:titleize) ? m.to_s.titleize : m.to_s.capitalize
10
10
  errors[m].each do |error|
11
11
  errors.add(new_method, "#{title} #{error}")
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module CombinedErrors
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: combined_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-02 00:00:00.000000000 Z
12
+ date: 2013-07-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -91,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  segments:
93
93
  - 0
94
- hash: -2086557416837512409
94
+ hash: 3963970468884106293
95
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  segments:
102
102
  - 0
103
- hash: -2086557416837512409
103
+ hash: 3963970468884106293
104
104
  requirements: []
105
105
  rubyforge_project:
106
106
  rubygems_version: 1.8.25