Class: ActiveResource::Errors
- Inherits:
-
Object
- Object
- ActiveResource::Errors
- Defined in:
- lib/remotable/active_resource_fixes.rb
Overview
ActiveResource expects that errors will be an array of string However, this is not what Rails Responders are inclined to return.
Instance Method Summary collapse
-
#from_array(array, save_cache = false) ⇒ Object
Grabs errors from an array of messages (like ActiveRecord::Validations).
Instance Method Details
#from_array(array, save_cache = false) ⇒ Object
Grabs errors from an array of messages (like ActiveRecord::Validations). The second parameter directs the errors cache to be cleared (default) or not (by passing true).
65 66 67 68 69 70 71 72 73 |
# File 'lib/remotable/active_resource_fixes.rb', line 65 def from_array(array, save_cache=false) clear unless save_cache hash = array[0] || {} hash.each do |key, value| Array.wrap(value).each do || self[key] = end end end |