ActiveModel::Errors
Active Resource validation is reported to and from this object, which is used by Base#save to determine whether the object in a valid state to be saved. See usage example in Validations.
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)
# File lib/active_resource/validations.rb, line 14 def from_array(messages, save_cache = false) clear unless save_cache humanized_attributes = @base.attributes.keys.inject({}) { |h, attr_name| h.update(attr_name.humanize => attr_name) } messages.each do |message| attr_message = humanized_attributes.keys.detect do |attr_name| if message[0, attr_name.size + 1] == "#{attr_name} " add humanized_attributes[attr_name], message[(attr_name.size + 1)..-1] end end self[:base] << message if attr_message.nil? end end
Generated with the Darkfish Rdoc Generator 2.