You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `ActiveResource::Validations#from_json` method emits deprecation
warnings when handling error response payloads that resemble the
following:
```
{"errors":["First cannot be empty"]}
{"first":["cannot be empty"]}
```
The deprecation was originally introduced in [c643605][] (Feb 4, 2012).
This commit removes documentation mentions of backwards-compatibility
along with the conditional branches that emit the deprecation warnings.
The removal of the backwards support is a breaking change.
[c643605]: c643605
mock.post"/people.json",{},%q({"errors":["Age can't be blank", "Name can't be blank", "Name must start with a letter", "Person quota full for today.", "Phone work can't be blank", "Phone is not valid"]}),422,"Content-Type"=>"application/json; charset=utf-8"
117
-
end
118
-
119
-
assert_deprecated(/as an array/,ActiveResource.deprecator)do
120
-
invalid_user_using_format(:json)do
121
-
assert@person.errors[:name].any?
122
-
assert_equal["can't be blank"],@person.errors[:age]
123
-
assert_equal["can't be blank","must start with a letter"],@person.errors[:name]
124
-
assert_equal["is not valid"],@person.errors[:phone]
125
-
assert_equal["can't be blank"],@person.errors[:phone_work]
126
-
assert_equal["Person quota full for today."],@person.errors[:base]
127
-
end
128
-
end
129
-
end
130
-
131
-
deftest_should_parse_3_1_style_json_errors
132
-
ActiveResource::HttpMock.respond_todo |mock|
133
-
mock.post"/people.json",{},%q({"age":["can't be blank"],"name":["can't be blank", "must start with a letter"],"person":["quota full for today."],"phone_work":["can't be blank"],"phone":["is not valid"]}),422,"Content-Type"=>"application/json; charset=utf-8"
134
-
end
135
-
136
-
assert_deprecated(/without a root/,ActiveResource.deprecator)do
137
-
invalid_user_using_format(:json)do
138
-
assert@person.errors[:name].any?
139
-
assert_equal["can't be blank"],@person.errors[:age]
140
-
assert_equal["can't be blank","must start with a letter"],@person.errors[:name]
141
-
assert_equal["is not valid"],@person.errors[:phone]
142
-
assert_equal["can't be blank"],@person.errors[:phone_work]
143
-
assert_equal["Person quota full for today."],@person.errors[:base]
0 commit comments