activemodel-errors-tree 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 772373d73766843b2c2ca35fd7e54465de21f8a0
4
- data.tar.gz: 0bbd37f0b7f9b15f9a34adbcf1acf4b19d8504d4
2
+ SHA256:
3
+ metadata.gz: d2941720b0183db2dfca93adaa79efe11b6a509e83b801b942fb6dd344350e48
4
+ data.tar.gz: f74fc3517654ffe0bc5e1caf72fb092fcaf6e95caeecc3b219a7fb861a6977f9
5
5
  SHA512:
6
- metadata.gz: a520c6f018fc91d711253bf0ae4f2e049181549b8d1a0d228d58a1b546918e8d1d43e2d9b7b8a19f32aea2f1b5293460cbf6d4bdc586086aa44d1a2e66bbf510
7
- data.tar.gz: 25332dda1bb48247af3a735364a18c88533fdd4765888bd28c20937b245aacee20d35f4ec61c19bd7cfb68ae2088106dcb646b59e6ea4852c908ccca5b575707
6
+ metadata.gz: e1921aa30ba322f943f20c7e3d9b951ed44bffcabfa487836ad558b978372030036158acb79a718197f90648f61ad0cbdab33c55d1a9f6556f9dc57089921c1d
7
+ data.tar.gz: 0024c57c1e61b77aad3d83a821eaa24a080c75ab06a9c9b6f18b2c008826a5ecc7fbc8dce9fa9cf15120c9e7c5bf187d796d50838bacfde14ba78889f18dda87
data/README.md CHANGED
@@ -71,7 +71,7 @@ the associations, and render out each association's errors.
71
71
 
72
72
  ### errors.details (the recommended way)
73
73
 
74
- If you use Rails 5 or include the `active_model-errors_details` gem, you can use
74
+ If you use Rails 5 or include the [active_model-errors_details](https://github.com/cowbell/active_model-errors_details) gem, you can use
75
75
  `@record.errors.tree.details` instead of `messages`. This is more API friendly
76
76
  since it let's your client decide on the actual messages.
77
77
 
@@ -4,28 +4,28 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "activemodel-errors-tree"
7
- spec.version = "0.1.0" # for some reason Rails applications do not like it defined in activemodel/errors/tree/version
7
+ spec.version = "0.2.0" # for some reason Rails applications do not like it defined in activemodel/errors/tree/version
8
8
  spec.authors = ["Oded Niv"]
9
9
  spec.email = ["oded.niv@gmail.com"]
10
10
 
11
11
  spec.summary = %q{ActiveModel errors format actually appropriate for APIs.}
12
12
  spec.description = %q{Builds a tree of errors instead of the 1-dimension one generated by ActiveMode::Base#errors.messages.}
13
13
  spec.homepage = "https://github.com/odedniv/activemodel-errors-tree"
14
- spec.license = "UNLICENSE"
14
+ spec.license = "Unlicense"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
17
  spec.bindir = "exe"
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "activesupport", ">= 4.2"
22
- spec.add_runtime_dependency "activemodel", ">= 4.2"
21
+ spec.required_ruby_version = ">= 3.0"
23
22
 
24
- spec.add_development_dependency "bundler", "~> 1.10"
25
- spec.add_development_dependency "rake", "~> 10.0"
26
- spec.add_development_dependency "rspec", "~> 3.2"
27
- spec.add_development_dependency "sqlite3", "~> 1.3"
28
- # TODO: switch to activerecord 5 and remove active_model-errors_details
29
- spec.add_development_dependency "active_model-errors_details", "~> 1.2"
30
- spec.add_development_dependency "activerecord", "~> 4.2"
23
+ spec.add_runtime_dependency "activesupport", "~> 6.1"
24
+ spec.add_runtime_dependency "activemodel", "~> 6.1"
25
+
26
+ spec.add_development_dependency "bundler", "~> 2.5"
27
+ spec.add_development_dependency "rake", "~> 13.2"
28
+ spec.add_development_dependency "rspec", "~> 3.13"
29
+ spec.add_development_dependency "sqlite3", "~> 1.4"
30
+ spec.add_development_dependency "activerecord", "~> 6.0"
31
31
  end
@@ -1,5 +1,5 @@
1
- require "active_model/errors"
2
- require "active_support/hash_with_indifferent_access"
1
+ require "active_model"
2
+ require "active_support"
3
3
 
4
4
  module ActiveModel
5
5
  class Errors
@@ -23,7 +23,7 @@ module ActiveModel
23
23
 
24
24
  def method_tree(method)
25
25
  result = ActiveSupport::HashWithIndifferentAccess.new
26
- @errors.keys.each do |original_attribute|
26
+ @errors.attribute_names.each do |original_attribute|
27
27
  attribute, sub_attribute = original_attribute.to_s.split(ATTRIBUTE_SEPARATOR, 2) # we really only care about the first one
28
28
  if sub_attribute.nil?
29
29
  result[attribute] = @errors.send(method)[original_attribute]
metadata CHANGED
@@ -1,127 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemodel-errors-tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Niv
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-16 00:00:00.000000000 Z
11
+ date: 2024-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.2'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.2'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.2'
33
+ version: '6.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.2'
40
+ version: '6.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.10'
47
+ version: '2.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.10'
54
+ version: '2.5'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '13.2'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '13.2'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.2'
75
+ version: '3.13'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.2'
82
+ version: '3.13'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: sqlite3
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.3'
89
+ version: '1.4'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '1.3'
97
- - !ruby/object:Gem::Dependency
98
- name: active_model-errors_details
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '1.2'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '1.2'
96
+ version: '1.4'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: activerecord
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
101
  - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: '4.2'
103
+ version: '6.0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
108
  - - "~>"
123
109
  - !ruby/object:Gem::Version
124
- version: '4.2'
110
+ version: '6.0'
125
111
  description: Builds a tree of errors instead of the 1-dimension one generated by ActiveMode::Base#errors.messages.
126
112
  email:
127
113
  - oded.niv@gmail.com
@@ -143,9 +129,9 @@ files:
143
129
  - lib/activemodel/errors/tree.rb
144
130
  homepage: https://github.com/odedniv/activemodel-errors-tree
145
131
  licenses:
146
- - UNLICENSE
132
+ - Unlicense
147
133
  metadata: {}
148
- post_install_message:
134
+ post_install_message:
149
135
  rdoc_options: []
150
136
  require_paths:
151
137
  - lib
@@ -153,16 +139,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
139
  requirements:
154
140
  - - ">="
155
141
  - !ruby/object:Gem::Version
156
- version: '0'
142
+ version: '3.0'
157
143
  required_rubygems_version: !ruby/object:Gem::Requirement
158
144
  requirements:
159
145
  - - ">="
160
146
  - !ruby/object:Gem::Version
161
147
  version: '0'
162
148
  requirements: []
163
- rubyforge_project:
164
- rubygems_version: 2.4.7
165
- signing_key:
149
+ rubygems_version: 3.5.9
150
+ signing_key:
166
151
  specification_version: 4
167
152
  summary: ActiveModel errors format actually appropriate for APIs.
168
153
  test_files: []